public function setup() { $cache = new \Prismic\Cache\ApcCache(); $cache->clear(); $sl = bootstrap::getServiceManager(); $this->context = $sl->get('NetgluePrismic\\Context'); }
public function testInstance() { $sl = bootstrap::getServiceManager(); $service = $sl->get('NetgluePrismic\\Service\\Sitemap'); $this->assertInstanceOf('NetgluePrismic\\Service\\Sitemap', $service); return $service; }
public function getServiceManager() { $services = bootstrap::getServiceManager(); $serviceManager = new ServiceManager(new ServiceManagerConfig()); $serviceManager->setAllowOverride(true); $serviceManager->setService('ApplicationConfig', $services->get('ApplicationConfig')); $serviceManager->get('ModuleManager')->loadModules(); return $serviceManager; }
public function testGetViewHelper() { $services = bootstrap::getServiceManager(); $manager = $services->get('ViewHelperManager'); $helper = $manager->create('NetgluePrismic\\View\\Helper\\Finder'); $this->assertInstanceOf('NetgluePrismic\\View\\Helper\\Finder', $helper); $this->assertInstanceOf('NetgluePrismic\\Context', $helper->getContext()); return $helper; }
public function testSetGetDocument() { $services = bootstrap::getServiceManager(); $manager = $services->get('ViewHelperManager'); $helper = $manager->get('NetgluePrismic\\View\\Helper\\EditAtPrismic'); $this->assertNull($helper->getDocument()); $helper->setDocument($this->document); $this->assertSame($this->document, $helper->getDocument()); return $helper; }
/** * @depends testSetGetController */ public function testMockParams(Prismic $plugin) { $mockParams = $this->getMock('\\Zend\\Mvc\\Controller\\Plugin\\Params'); $mockParams->expects($this->any())->method('fromRoute')->will($this->returnValue('unit-test-bookmark')); $this->mockParams = $mockParams; $services = bootstrap::getServiceManager(); $manager = $services->get('ControllerPluginManager'); $manager->setService('params', $mockParams); $this->assertSame('unit-test-bookmark', $plugin->getBookmarkNameFromRoute()); $document = $plugin->getDocument(); $this->assertInstanceOf('Prismic\\Document', $document); return $document; }
public function getContainer() { $services = bootstrap::getServiceManager(); return $services->get('NetgluePrismic\\Session\\PrismicContainer'); }
public function getHelper() { $services = bootstrap::getServiceManager(); $manager = $services->get('ViewHelperManager'); return $manager->get('NetgluePrismic\\View\\Helper\\Prismic'); }
public function setUp() { $services = bootstrap::getServiceManager(); $this->context = $services->get('Prismic\\Context'); $this->context->getPrismicApi()->getCache()->clear(); }
} protected static function initAutoloader() { $vendorPath = static::findParentPath('vendor'); if (is_readable($vendorPath . '/autoload.php')) { $loader = (include $vendorPath . '/autoload.php'); } else { $zf2Path = getenv('ZF2_PATH') ?: (defined('ZF2_PATH') ? ZF2_PATH : (is_dir($vendorPath . '/ZF2/library') ? $vendorPath . '/ZF2/library' : false)); if (!$zf2Path) { throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); } include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; } AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__)))); } protected static function findParentPath($path) { $dir = __DIR__; $previousDir = '.'; while (!is_dir($dir . '/' . $path)) { $dir = dirname($dir); if ($previousDir === $dir) { return false; } $previousDir = $dir; } return $dir . '/' . $path; } } bootstrap::init();
public function setUp() { $services = bootstrap::getServiceManager(); $this->api = $services->get('Prismic\\Api'); }