public function testFactory() { $serviceManager = new ServiceManager(); $pluginManager = new HelperPluginManager(); $pluginManager->setServiceLocator($serviceManager); $serviceManager->setService('ZfcRbac\\Service\\RoleService', $this->getMock('ZfcRbac\\Service\\RoleService', [], [], '', false)); $factory = new HasRoleViewHelperFactory(); $viewHelper = $factory->createService($pluginManager); $this->assertInstanceOf('ZfcRbac\\View\\Helper\\HasRole', $viewHelper); }
public function testFactory() { $serviceManager = new ServiceManager(); if (method_exists($serviceManager, 'build')) { $this->markTestSkipped('this test is only vor zend-servicemanager v2'); } $pluginManager = new HelperPluginManager($serviceManager); $serviceManager->setService('ZfcRbac\\Service\\RoleService', $this->getMock('ZfcRbac\\Service\\RoleService', [], [], '', false)); $factory = new HasRoleViewHelperFactory(); $viewHelper = $factory->createService($pluginManager); $this->assertInstanceOf('ZfcRbac\\View\\Helper\\HasRole', $viewHelper); }