SlugifyViewHelperFactoryTest.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Cocur\Slugify\Bridge\ZF2;
  3. use Cocur\Slugify\Slugify;
  4. use Zend\ServiceManager\ServiceManager;
  5. use Zend\View\HelperPluginManager;
  6. /**
  7. * Class SlugifyViewHelperFactoryTest
  8. * @package cocur/slugify
  9. * @subpackage bridge
  10. * @license http://www.opensource.org/licenses/MIT The MIT License
  11. */
  12. class SlugifyViewHelperFactoryTest extends \PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @var SlugifyViewHelperFactory
  16. */
  17. private $factory;
  18. public function setUp()
  19. {
  20. $this->factory = new SlugifyViewHelperFactory();
  21. }
  22. /**
  23. * @test
  24. * @covers Cocur\Slugify\Bridge\ZF2\SlugifyViewHelperFactory::__invoke()
  25. */
  26. public function createService()
  27. {
  28. $sm = new ServiceManager();
  29. $sm->setService('Cocur\Slugify\Slugify', new Slugify());
  30. $vhm = new HelperPluginManager();
  31. $vhm->setServiceLocator($sm);
  32. $viewHelper = call_user_func($this->factory, $vhm);
  33. $this->assertInstanceOf('Cocur\Slugify\Bridge\ZF2\SlugifyViewHelper', $viewHelper);
  34. }
  35. }