コード例 #1
0
 public function testGetDirectoryWrite()
 {
     /** @var \Magento\Framework\Filesystem\Directory\WriteInterface $dirWriteMock */
     $dirWriteMock = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\WriteInterface');
     $this->_dirWriteFactoryMock->expects($this->once())->method('create')->will($this->returnValue($dirWriteMock));
     $this->assertEquals($dirWriteMock, $this->_filesystem->getDirectoryWrite(DirectoryList::ROOT));
 }
コード例 #2
0
ファイル: PublisherTest.php プロジェクト: Zash22/magento
 protected function setUp()
 {
     $this->filesystem = $this->getMock('Magento\\Framework\\Filesystem', [], [], '', false);
     $this->materializationStrategyFactory = $this->getMock('Magento\\Framework\\App\\View\\Asset\\MaterializationStrategy\\Factory', [], [], '', false);
     $this->writeFactory = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\WriteFactory', [], [], '', false);
     $this->object = new Publisher($this->filesystem, $this->materializationStrategyFactory, $this->writeFactory);
     $this->sourceDirWrite = $this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\Directory\\WriteInterface');
     $this->staticDirRead = $this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\Directory\\ReadInterface');
     $this->staticDirWrite = $this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\Directory\\WriteInterface');
     $this->filesystem->expects($this->any())->method('getDirectoryRead')->with(DirectoryList::STATIC_VIEW)->will($this->returnValue($this->staticDirRead));
     $this->filesystem->expects($this->any())->method('getDirectoryWrite')->will($this->returnValue($this->staticDirWrite));
     $this->writeFactory->expects($this->any())->method('create')->willReturn($this->sourceDirWrite);
 }
コード例 #3
0
ファイル: MigrationTest.php プロジェクト: okite11/frames21
 public function testLaunchWithException()
 {
     $writer = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\WriteInterface');
     $writer->expects($this->any())->method('isDirectory')->will($this->returnValue(false));
     $writer->expects($this->any())->method('create')->will($this->returnValue(true));
     $this->writeFactory->expects($this->any())->method('create')->will($this->returnValue($writer));
     $shell = $this->getMock('\\Migration\\App\\Shell', ['run'], [], '', false);
     $shell->expects($this->any())->method('run')->willThrowException(new \Exception('error'));
     $this->shellFactory->expects($this->any())->method('create')->will($this->returnValue($shell));
     ob_start();
     $this->migration->launch();
     $error = ob_get_clean();
     $this->assertEquals('error', $error);
 }