Example #1
0
 /**
  * @group ZF-7461
  */
 public function testRegistryIsUsedWhenNumericRegistryValueIsGiven()
 {
     // Register view for cases where registry should/is not (be) used
     $this->broker->registerSpec('view');
     $this->bootstrap->getResource('view');
     $options1 = array('pages' => array(new MvcPage(array('action' => 'index', 'controller' => 'index'))), 'storage' => array('registry' => true));
     $options = array($options1, array_merge($options1, array('storage' => array('registry' => '1'))), array_merge($options1, array('storage' => array('registry' => 1))), array_merge($options1, array('storage' => array('registry' => false))));
     $results = array();
     $key = NavigationResource::DEFAULT_REGISTRY_KEY;
     foreach ($options as $option) {
         $resource = new NavigationResource($option);
         $resource->setBootstrap($this->bootstrap)->init();
         $results[] = Registry::get($key) instanceof \Zend\Navigation\Navigation;
         Registry::set($key, null);
     }
     $this->assertEquals(array(true, true, true, false), $results);
     $this->broker->unregisterSpec('view');
 }
Example #2
0
    /**
     * @group ZF-7461
     */
    public function testRegistryIsUsedWhenNumericRegistryValueIsGiven()
    {
        $this->markTestSkipped('NavigationResource has fatal error - skip this test now.');
        return;

        // Register view for cases where registry should/is not (be) used
        $this->bootstrap->registerPluginResource('view');
        $this->bootstrap->getPluginResource('view')->getView();

        $options1 = array(
            'pages'=> array(new NavigationPage\Mvc(array(
                'action'     => 'index',
                'controller' => 'index'))
            ),
            'storage' => array('registry' => true)
        );
        $options = array(
            $options1,
            array_merge($options1, array('storage' => array('registry' => '1'))), // Original culprit here
            array_merge($options1, array('storage' => array('registry' => 1))),
            array_merge($options1, array('storage' => array('registry' => false)))
        );

        $results = array();
        $key = NavigationResource::DEFAULT_REGISTRY_KEY;
        foreach($options as $option) {
            $resource = new NavigationResource($option);
            $resource->setBootstrap($this->bootstrap)->init();
            $results[] = Registry::get($key) instanceof \Zend\Navigation\Navigation;
            Registry::set($key,null);
        }

        $this->assertEquals(array(true,true,true,false),$results);
        $this->bootstrap->unregisterPluginResource('view');
    }