Skip to content

Commit

Permalink
Allow twig/twig 2.0 (#74)
Browse files Browse the repository at this point in the history
Twig 2.0 is out, let's allow it!
  • Loading branch information
greg0ire authored Jan 6, 2017
1 parent a7aee95 commit 8f68e66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"symfony/framework-bundle": "^2.7 || ^3.0",
"symfony/twig-bundle": "^2.7 || ^3.0",
"symfony/validator": "^2.7 || ^3.0",
"twig/twig": "^1.24"
"twig/twig": "^1.24 || ^2.0"
},
"suggest": {
"symfony/form": "To use enum form type",
Expand Down
10 changes: 8 additions & 2 deletions test/Bridge/Twig/Extension/EnumExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ protected function setUp()

public function testEnvironment()
{
$twig = new \Twig_Environment();
$twig = new \Twig_Environment($this->createMock(\Twig_LoaderInterface::class));
$twig->addExtension($this->extension);

$this->assertTrue($twig->hasExtension('greg0ire_enum'));
$this->assertInstanceOf(\Twig_SimpleFilter::class, $twig->getFilter('enum_label'));

if (version_compare(\Twig_Environment::VERSION, '1.26.0') === -1) {
$this->assertTrue($twig->hasExtension('greg0ire_enum'));

return;
}
$this->assertTrue($twig->hasExtension(EnumExtension::class));
}

/**
Expand Down

0 comments on commit 8f68e66

Please sign in to comment.