SonataAdminExtensionTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Tests\Twig\Extension;
  11. use Sonata\AdminBundle\Twig\Extension\SonataAdminExtension;
  12. use Sonata\AdminBundle\Admin\Pool;
  13. class SonataAdminExtensionTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function testSlugify()
  16. {
  17. $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
  18. $pool = new Pool($container, '','');
  19. $s = new SonataAdminExtension($pool);
  20. $this->assertEquals($s->slugify('test'), 'test');
  21. $this->assertEquals($s->slugify('S§!@@#$#$alut'), 's-alut');
  22. $this->assertEquals($s->slugify('Symfony2'), 'symfony2');
  23. $this->assertEquals($s->slugify('test'), 'test');
  24. $this->assertEquals($s->slugify('c\'est bientôt l\'été'), 'c-est-bientot-l-ete');
  25. $this->assertEquals($s->slugify(urldecode('%2Fc\'est+bientôt+l\'été')), 'c-est-bientot-l-ete');
  26. }
  27. }