From 14ce2c2b8ec92d60d18593ddb4bfec62db7f780a Mon Sep 17 00:00:00 2001 From: JakeFr Date: Thu, 23 Mar 2017 12:49:58 +0100 Subject: [PATCH] Allow twig 2 --- README.md | 6 +++--- composer.json | 2 +- src/Bridge/Twig/SlugifyExtension.php | 8 -------- tests/Bridge/Silex/SlugifySilexProviderTest.php | 3 ++- tests/Bridge/Twig/SlugifyExtensionTest.php | 9 --------- 5 files changed, 6 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 2eeabf6a..a0cf38df 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ removing these characters, Slugify approximates them (e.g., `ae` replaces `รค`). - PSR-4 compatible. - Compatible with PHP >= 5.5.9, PHP 7 and [HHVM](http://hhvm.com). - Integrations for [Symfony2](http://symfony.com), [Silex (1 and 2)](http://silex.sensiolabs.org), [Laravel](http://laravel.com), -[Twig](http://twig.sensiolabs.org), [Zend Framework 2](http://framework.zend.com/), [Nette Framework](http://nette.org/), +[Twig (1 and 2)](http://twig.sensiolabs.org), [Zend Framework 2](http://framework.zend.com/), [Nette Framework](http://nette.org/), [Latte](http://latte.nette.org/) and [Plum](https://github.com/plumphp/plum). @@ -95,7 +95,7 @@ You can find a list of the available rulesets in `Resources/rules`. ### More options -The constructor takes an options array, you have already seen the `rulesets` options above. You can also change the +The constructor takes an options array, you have already seen the `rulesets` options above. You can also change the regular expression that is used to replace characters with the separator. ```php @@ -654,7 +654,7 @@ inform us if a transliteration is wrong. We would highly appreciate it if you ca Github. If you have never contributed to a project on Github we are happy to help you. Just ask on Twitter or directly join our Gitter. -You always can help me (Florian, the original developer and maintainer) out by +You always can help me (Florian, the original developer and maintainer) out by [sending me an Euro or two](https://paypal.me/florianec/2). diff --git a/composer.json b/composer.json index 9bc7a75b..f391fd4f 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "symfony/config": "~2.4|~3.0", "symfony/dependency-injection": "~2.4|~3.0", "symfony/http-kernel": "~2.4|~3.0", - "twig/twig": "~1.12", + "twig/twig": "~1.26|~2.0", "zendframework/zend-modulemanager": "~2.2", "zendframework/zend-servicemanager": "~2.2", "zendframework/zend-view": "~2.2" diff --git a/src/Bridge/Twig/SlugifyExtension.php b/src/Bridge/Twig/SlugifyExtension.php index 7ebbb3d3..83037451 100644 --- a/src/Bridge/Twig/SlugifyExtension.php +++ b/src/Bridge/Twig/SlugifyExtension.php @@ -66,12 +66,4 @@ public function slugifyFilter($string, $separator = null) { return $this->slugify->slugify($string, $separator); } - - /** - * {@inheritDoc} - */ - public function getName() - { - return 'slugify_extension'; - } } diff --git a/tests/Bridge/Silex/SlugifySilexProviderTest.php b/tests/Bridge/Silex/SlugifySilexProviderTest.php index 318b8120..2db5eff5 100644 --- a/tests/Bridge/Silex/SlugifySilexProviderTest.php +++ b/tests/Bridge/Silex/SlugifySilexProviderTest.php @@ -12,6 +12,7 @@ namespace Cocur\Slugify\Tests\Bridge\Silex; use Cocur\Slugify\Bridge\Silex\SlugifyServiceProvider; +use Cocur\Slugify\Bridge\Twig\SlugifyExtension; use Silex\Application; use Silex\Provider\TwigServiceProvider; @@ -54,6 +55,6 @@ public function registerWithTwig() $app->register(new TwigServiceProvider()); $app->register(new SlugifyServiceProvider()); - $this->assertTrue($app['twig']->hasExtension('slugify_extension')); + $this->assertTrue($app['twig']->hasExtension(SlugifyExtension::class)); } } diff --git a/tests/Bridge/Twig/SlugifyExtensionTest.php b/tests/Bridge/Twig/SlugifyExtensionTest.php index c1da9647..ceaa3c18 100644 --- a/tests/Bridge/Twig/SlugifyExtensionTest.php +++ b/tests/Bridge/Twig/SlugifyExtensionTest.php @@ -44,15 +44,6 @@ protected function setUp() $this->extension = new SlugifyExtension($this->slugify); } - /** - * @test - * @covers Cocur\Slugify\Bridge\Twig\SlugifyExtension::getName() - */ - public function getNameReturnsNameOfExtension() - { - $this->assertEquals('slugify_extension', $this->extension->getName()); - } - /** * @test * @covers Cocur\Slugify\Bridge\Twig\SlugifyExtension::getFilters()