public function testNamespaceRegisteredInPlaceholderRegistryAfterInstantiation()
 {
     $registry = PlaceholderRegistry::getRegistry();
     if ($registry->containerExists('Zend_View_Helper_HeadLink')) {
         $registry->deleteContainer('Zend_View_Helper_HeadLink');
     }
     $this->assertFalse($registry->containerExists('Zend_View_Helper_HeadLink'));
     $helper = new Helper\HeadLink();
     $this->assertTrue($registry->containerExists('Zend_View_Helper_HeadLink'));
 }
Example #2
0
 /**
  * Constructor
  *
  * Retrieve container registry from Zend_Registry, or create new one and register it.
  *
  * @return void
  */
 public function __construct()
 {
     $this->_registry = Placeholder\Registry::getRegistry();
 }
Example #3
0
File: Layout.php Project: hjr3/zf2
 /**
  * Initialize placeholder container for layout vars
  *
  * @return \Zend\View\Helper\Placeholder\Container
  */
 protected function _initVarContainer()
 {
     if (null === $this->_container) {
         $this->_container = \Zend\View\Helper\Placeholder\Registry::getRegistry()->getContainer(__CLASS__);
     }
     return $this->_container;
 }
Example #4
0
 public function testGetRegistryRegistersWithGlobalRegistry()
 {
     $this->assertFalse(\Zend\Registry::isRegistered(Registry::REGISTRY_KEY));
     $registry = Registry::getRegistry();
     $this->assertTrue(\Zend\Registry::isRegistered(Registry::REGISTRY_KEY));
     $registered = \Zend\Registry::get(Registry::REGISTRY_KEY);
     $this->assertSame($registry, $registered);
 }
Example #5
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     $this->setRegistry(Registry::getRegistry());
     $this->setContainer($this->getRegistry()->getContainer($this->_regKey));
 }
Example #6
0
 public function testGetRegistrySubsequentTimesReturnsSameInstance()
 {
     $registry1 = Registry::getRegistry();
     $registry2 = Registry::getRegistry();
     $this->assertSame($registry1, $registry2);
 }
Example #7
0
 /**
  * Initialize placeholder container for layout vars
  *
  * @return \Zend\View\Helper\Placeholder\Container
  */
 protected function initVarContainer()
 {
     if (null === $this->container) {
         $this->container = PlaceholderRegistry::getRegistry()->getContainer(get_called_class());
     }
     return $this->container;
 }