protected function setUp() { $this->objectManagerHelper = new ObjectManagerHelper($this); $this->scheduledStructureMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\ScheduledStructure')->disableOriginalConstructor()->getMock(); $this->structureMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\Data\\Structure')->disableOriginalConstructor()->getMock(); $this->generatorContextMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\Generator\\Context')->disableOriginalConstructor()->getMock(); $this->generatorContextMock->expects($this->any())->method('getStructure')->willReturn($this->structureMock); $this->readerContextMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\Reader\\Context')->disableOriginalConstructor()->getMock(); $this->readerContextMock->expects($this->any())->method('getScheduledStructure')->willReturn($this->scheduledStructureMock); $this->container = $this->objectManagerHelper->getObject('Magento\\Framework\\View\\Layout\\Generator\\Container'); }
/** * @return void */ protected function setUp() { // ScheduledStructure $this->readerContextMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\Reader\\Context')->disableOriginalConstructor()->getMock(); $this->scheduledStructure = new ScheduledStructure(); $this->readerContextMock->expects($this->any())->method('getScheduledStructure')->willReturn($this->scheduledStructure); // DataStructure $this->generatorContextMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\Generator\\Context')->disableOriginalConstructor()->getMock(); $this->structureMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\Data\\Structure')->disableOriginalConstructor()->setMethods(['reorderChildElement'])->getMock(); $this->generatorContextMock->expects($this->any())->method('getStructure')->willReturn($this->structureMock); $this->helperMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\ScheduledStructure\\Helper')->disableOriginalConstructor()->getMock(); $helperObjectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->model = $helperObjectManager->getObject('Magento\\Framework\\View\\Layout\\GeneratorPool', ['helper' => $this->helperMock, 'generators' => $this->getGeneratorsMocks()]); }