Ejemplo n.º 1
0
 /**
  * @param array $type
  * @param array $blockInstance
  * @dataProvider getBlockSingletonDataProvider
  */
 public function testGetBlockSingleton($type, $blockInstance, $isAbstract)
 {
     $blockMock = $this->getMock($blockInstance, [], [], '', false);
     $this->generatorBlockMock->expects($this->once())->method('createBlock')->will($this->returnValue($blockMock));
     if ($isAbstract) {
         $blockMock->expects($this->any())->method('setLayout')->with($this->equalTo($this->model))->will($this->returnSelf());
     }
     $this->assertInstanceOf($blockInstance, $this->model->getBlockSingleton($type));
     // singleton test
     $this->assertInstanceOf($blockInstance, $this->model->getBlockSingleton($type));
 }
Ejemplo n.º 2
0
 public function testGetBlockSingleton()
 {
     $block = $this->_layout->getBlockSingleton('Magento\\Framework\\View\\Element\\Text');
     $this->assertInstanceOf('Magento\\Framework\\View\\Element\\Text', $block);
     $this->assertSame($block, $this->_layout->getBlockSingleton('Magento\\Framework\\View\\Element\\Text'));
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getBlockSingleton($type)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getBlockSingleton');
     if (!$pluginInfo) {
         return parent::getBlockSingleton($type);
     } else {
         return $this->___callPlugins('getBlockSingleton', func_get_args(), $pluginInfo);
     }
 }