Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix examples and phpspec definition for Twig 3 #16

Merged
merged 1 commit into from Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
}
}