public function testExecute() { $this->objectManager->expects($this->once()) ->method('get') ->with('Magento\Framework\App\Cache') ->willReturn($this->cacheMock); $this->cacheMock->expects($this->once())->method('clean'); $writeDirectory = $this->getMock('Magento\Framework\Filesystem\Directory\WriteInterface'); $writeDirectory->expects($this->atLeastOnce())->method('delete'); $this->filesystem->expects($this->atLeastOnce())->method('getDirectoryWrite')->willReturn($writeDirectory); $this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(true); $progressBar = $this->getMockBuilder( 'Symfony\Component\Console\Helper\ProgressBar' ) ->disableOriginalConstructor() ->getMock(); $this->objectManager->expects($this->once())->method('configure'); $this->objectManager ->expects($this->once()) ->method('create') ->with('Symfony\Component\Console\Helper\ProgressBar') ->willReturn($progressBar); $this->manager->expects($this->exactly(6))->method('addOperation'); $this->manager->expects($this->once())->method('process'); $tester = new CommandTester($this->command); $tester->execute([]); $this->assertContains( 'Generated code and dependency injection configuration successfully.', explode(PHP_EOL, $tester->getDisplay()) ); }
public function testExecute() { $this->directoryListMock->expects($this->atLeastOnce())->method('getPath')->willReturn(null); $this->objectManagerMock->expects($this->once())->method('get')->with('Magento\\Framework\\App\\Cache')->willReturn($this->cacheMock); $this->cacheMock->expects($this->once())->method('clean'); $writeDirectory = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\WriteInterface'); $writeDirectory->expects($this->atLeastOnce())->method('delete'); $this->filesystemMock->expects($this->atLeastOnce())->method('getDirectoryWrite')->willReturn($writeDirectory); $this->deploymentConfigMock->expects($this->once())->method('get')->with(\Magento\Framework\Config\ConfigOptionsListConstants::KEY_MODULES)->willReturn(['Magento_Catalog' => 1]); $progressBar = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\ProgressBar')->disableOriginalConstructor()->getMock(); $this->objectManagerMock->expects($this->once())->method('configure'); $this->objectManagerMock->expects($this->once())->method('create')->with('Symfony\\Component\\Console\\Helper\\ProgressBar')->willReturn($progressBar); $this->managerMock->expects($this->exactly(7))->method('addOperation'); $this->managerMock->expects($this->once())->method('process'); $tester = new CommandTester($this->command); $tester->execute([]); $this->assertContains('Generated code and dependency injection configuration successfully.', explode(PHP_EOL, $tester->getDisplay())); $this->assertSame(DiCompileCommand::NAME, $this->command->getName()); }
public function testExecute() { $this->objectManager->expects($this->once()) ->method('get') ->with('Magento\Framework\App\Cache') ->willReturn($this->cacheMock); $this->cacheMock->expects($this->once())->method('clean'); $writeDirectory = $this->getMock('Magento\Framework\Filesystem\Directory\WriteInterface'); $writeDirectory->expects($this->atLeastOnce())->method('delete'); $this->filesystem->expects($this->atLeastOnce())->method('getDirectoryWrite')->willReturn($writeDirectory); $this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(true); $this->objectManager->expects($this->once())->method('configure'); $this->manager->expects($this->exactly(6))->method('addOperation'); $this->manager->expects($this->once())->method('process'); $tester = new CommandTester($this->command); $tester->execute([]); $this->assertEquals( 'Generated code and dependency injection configuration successfully.' . PHP_EOL, $tester->getDisplay() ); }