SlugifyViewHelperFactoryTest.php 1.1 KB

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