Skip to content

Commit

Permalink
Fix examples and phpspec definition for Twig 3 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
finwe committed Mar 20, 2024
1 parent 35435a8 commit 7b023ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .gitignore
@@ -1,2 +1,4 @@
bin
vendor
vendor
composer.lock
.phpunit.cache/
4 changes: 2 additions & 2 deletions examples/basic.php
Expand Up @@ -2,12 +2,12 @@

require __DIR__.'/../vendor/autoload.php';

$loader = new Twig_Loader_Array(array(
$loader = new Twig\Loader\ArrayLoader(array(
'uniqid' => 'Hi, I am unique: {{ php_uniqid() }}.',
'floor' => 'And {{ php_floor(7.7) }} is floor of 7.7.',
));

$twig = new Twig_Environment($loader);
$twig = new Twig\Environment($loader);
$twig->addExtension(new Umpirsky\Twig\Extension\PhpFunctionExtension());

echo $twig->render('uniqid') . PHP_EOL;
Expand Down
7 changes: 4 additions & 3 deletions spec/Umpirsky/Twig/Extension/PhpFunctionExtensionSpec.php
Expand Up @@ -3,17 +3,18 @@
namespace spec\Umpirsky\Twig\Extension;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Twig\Extension\AbstractExtension;
use Umpirsky\Twig\Extension\PhpFunctionExtension;

class PhpFunctionExtensionSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('Umpirsky\Twig\Extension\PhpFunctionExtension');
$this->shouldHaveType(PhpFunctionExtension::class);
}

function it_is_a_Twig_extension()
{
$this->shouldHaveType('Twig_Extension');
$this->shouldHaveType(AbstractExtension::class);
}
}

0 comments on commit 7b023ab

Please sign in to comment.