SlugifyViewHelperTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Cocur\Slugify\Bridge\ZF2;
  3. use Cocur\Slugify\Slugify;
  4. /**
  5. * Class SlugifyViewHelperTest
  6. * @package cocur/slugify
  7. * @subpackage bridge
  8. * @license http://www.opensource.org/licenses/MIT The MIT License
  9. */
  10. class SlugifyViewHelperTest extends \PHPUnit_Framework_TestCase
  11. {
  12. /**
  13. * @var SlugifyViewHelper
  14. */
  15. private $viewHelper;
  16. /**
  17. * @var Slugify
  18. */
  19. private $slugify;
  20. /**
  21. * @covers Cocur\Slugify\Bridge\ZF2\SlugifyViewHelper::__construct()
  22. */
  23. public function setUp()
  24. {
  25. $this->slugify = new Slugify();
  26. $this->viewHelper = new SlugifyViewHelper($this->slugify);
  27. }
  28. /**
  29. * @test
  30. * @covers Cocur\Slugify\Bridge\ZF2\SlugifyViewHelper::__invoke()
  31. */
  32. public function invoke()
  33. {
  34. $actual = 'Hällo Wörld';
  35. $expected = call_user_func($this->viewHelper, $actual);
  36. $this->assertEquals($expected, $this->slugify->slugify($actual));
  37. $expected = call_user_func($this->viewHelper, $actual, '_');
  38. $this->assertEquals($expected, $this->slugify->slugify($actual, '_'));
  39. }
  40. }