19 private $getBlockByIdentifierCommand;
29 private $blockFactory;
34 private $blockResource;
38 $this->blockFactory = $this->getMockBuilder(\
Magento\Cms\Model\BlockFactory::class)
39 ->disableOriginalConstructor()
40 ->setMethods([
'create'])
44 ->disableOriginalConstructor()
47 $this->block = $this->getMockBuilder(\
Magento\Cms\Model\Block::class)
48 ->disableOriginalConstructor()
49 ->setMethods([
'setStoreId',
'getId'])
52 $this->getBlockByIdentifierCommand =
new GetBlockByIdentifier($this->blockFactory, $this->blockResource);
60 $identifier =
'banner';
63 $this->blockFactory->expects($this->once())
65 ->willReturn($this->block);
67 $this->block->expects($this->once())
68 ->method(
'setStoreId')
69 ->willReturn($this->block);
71 $this->block->expects($this->once())
75 $this->blockResource->expects($this->once())
77 ->with($this->block, $identifier)
78 ->willReturn($this->block);
80 $this->getBlockByIdentifierCommand->execute($identifier,
$storeId);