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. use Mockery\Adapter\Phpunit\MockeryTestCase;
  8. /**
  9. * Class SlugifyViewHelperFactoryTest
  10. * @package cocur/slugify
  11. * @subpackage bridge
  12. * @license http://www.opensource.org/licenses/MIT The MIT License
  13. */
  14. class SlugifyViewHelperFactoryTest extends MockeryTestCase
  15. {
  16. /**
  17. * @var SlugifyViewHelperFactory
  18. */
  19. private $factory;
  20. protected function setUp(): void
  21. {
  22. $this->factory = new SlugifyViewHelperFactory();
  23. }
  24. /**
  25. * @covers \Cocur\Slugify\Bridge\ZF2\SlugifyViewHelperFactory::__invoke()
  26. */
  27. public function testCreateService()
  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. }