9 use \Magento\Framework\View\BlockPool;
29 $this->blockFactory = $this->getMockBuilder(\
Magento\Framework\View\
Element\BlockFactory::class)
30 ->disableOriginalConstructor()
31 ->setMethods([
'createBlock'])
33 $this->blockPool =
new BlockPool($this->blockFactory);
38 $blockName =
'testName';
39 $blockClass = \Magento\Framework\View\Test\Unit\BlockPoolTestBlock::class;
42 $block = $this->createMock(\
Magento\Framework\View\Test\Unit\BlockPoolTestBlock::class);
44 $this->blockFactory->expects($this->atLeastOnce())
45 ->method(
'createBlock')
47 ->will($this->returnValue(
$block));
49 $this->assertEquals($this->blockPool, $this->blockPool->add($blockName, $blockClass,
$arguments));
51 $this->assertEquals([$blockName =>
$block], $this->blockPool->get());
52 $this->assertEquals(
$block, $this->blockPool->get($blockName));
53 $this->assertNull($this->blockPool->get(
'someWrongName'));
62 $this->blockPool->add(
'BlockPoolTestBlock',
'NotExistingBlockClass');