當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DirectoryList::expects方法代碼示例

本文整理匯總了PHP中Magento\Framework\App\Filesystem\DirectoryList::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP DirectoryList::expects方法的具體用法?PHP DirectoryList::expects怎麽用?PHP DirectoryList::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\App\Filesystem\DirectoryList的用法示例。


在下文中一共展示了DirectoryList::expects方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetTranslationFileTimestamp

 public function testGetTranslationFileTimestamp()
 {
     $path = 'path';
     $contextMock = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\Asset\\ContextInterface', [], '', true, true, true, ['getPath']);
     $this->assetRepoMock->expects($this->atLeastOnce())->method('getStaticViewFileContext')->willReturn($contextMock);
     $contextMock->expects($this->atLeastOnce())->method('getPath')->willReturn($path);
     $this->directoryListMock->expects($this->atLeastOnce())->method('getPath')->willReturn($path);
     $this->driverFileMock->expects($this->once())->method('isExists')->with('path/path/js-translation.json')->willReturn(true);
     $this->driverFileMock->expects($this->once())->method('stat')->willReturn(['mtime' => 1445736974]);
     $this->assertEquals(1445736974, $this->model->getTranslationFileTimestamp());
 }
開發者ID:tingyeeh,項目名稱:magento2,代碼行數:11,代碼來源:FileManagerTest.php

示例2: testCheckActionWithError

 public function testCheckActionWithError()
 {
     $this->directoryList->expects($this->once())->method('getPath')->willReturn(__DIR__);
     $this->filesystem->expects($this->once())->method('validateAvailableDiscSpace')->will($this->throwException(new \Exception("Test error message")));
     $jsonModel = $this->controller->checkAction();
     $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $jsonModel);
     $variables = $jsonModel->getVariables();
     $this->assertArrayHasKey('responseType', $variables);
     $this->assertEquals(ResponseTypeInterface::RESPONSE_TYPE_ERROR, $variables['responseType']);
     $this->assertArrayHasKey('error', $variables);
     $this->assertEquals("Test error message", $variables['error']);
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:12,代碼來源:BackupActionItemsTest.php

示例3: setUp

 public function setUp()
 {
     $this->composerJsonFinder = $this->getMock('Magento\\Framework\\Composer\\ComposerJsonFinder', [], [], '', false);
     $this->composerJsonFinder->expects($this->once())->method('findComposerJson')->willReturn('composer.json');
     $this->directoryList = $this->getMock('Magento\\Framework\\App\\Filesystem\\DirectoryList', [], [], '', false);
     $this->directoryList->expects($this->exactly(2))->method('getPath')->willReturn('var');
     $this->reqUpdDryRunCommand = $this->getMock('Magento\\Composer\\RequireUpdateDryRunCommand', [], [], '', false);
     $this->file = $this->getMock('Magento\\Framework\\Filesystem\\Driver\\File', [], [], '', false);
     $this->file->expects($this->once())->method('copy')->with('composer.json', 'var/composer.json');
     $composerAppFactory = $this->getMock('Magento\\Framework\\Composer\\MagentoComposerApplicationFactory', [], [], '', false);
     $composerAppFactory->expects($this->once())->method('createRequireUpdateDryRunCommand')->willReturn($this->reqUpdDryRunCommand);
     $this->dependencyReadinessCheck = new DependencyReadinessCheck($this->composerJsonFinder, $this->directoryList, $this->file, $composerAppFactory);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:13,代碼來源:DependencyReadinessCheckTest.php

示例4: setUpDirectoryListInstallation

 public function setUpDirectoryListInstallation()
 {
     $this->directoryListMock->expects($this->at(0))->method('getPath')->with(DirectoryList::CONFIG)->will($this->returnValue(BP . '/app/etc'));
     $this->directoryListMock->expects($this->at(1))->method('getPath')->with(DirectoryList::VAR_DIR)->will($this->returnValue(BP . '/var'));
     $this->directoryListMock->expects($this->at(2))->method('getPath')->with(DirectoryList::MEDIA)->will($this->returnValue(BP . '/pub/media'));
     $this->directoryListMock->expects($this->at(3))->method('getPath')->with(DirectoryList::STATIC_VIEW)->will($this->returnValue(BP . '/pub/static'));
 }
開發者ID:Zash22,項目名稱:magento,代碼行數:7,代碼來源:FilePermissionsTest.php

示例5: setUp

 public function setUp()
 {
     $this->objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface', [], [], '', false);
     $this->log = $this->getMock('Magento\Framework\Setup\LoggerInterface', [], [], '', false);
     $this->directoryList = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false);
     $this->path = realpath(__DIR__);
     $this->directoryList->expects($this->any())
         ->method('getRoot')
         ->willReturn($this->path);
     $this->directoryList->expects($this->any())
         ->method('getPath')
         ->willReturn($this->path);
     $this->file = $this->getMock('Magento\Framework\Filesystem\Driver\File', [], [], '', false);
     $this->filesystem = $this->getMock('Magento\Framework\Backup\Filesystem', [], [], '', false);
     $this->database = $this->getMock('Magento\Framework\Backup\Db', [], [], '', false);
     $this->helper = $this->getMock('Magento\Framework\Backup\Filesystem\Helper', [], [], '', false);
     $this->helper->expects($this->any())
         ->method('getInfo')
         ->willReturn(['writable' => true, 'size' => 100]);
     $configLoader = $this->getMock('Magento\Framework\App\ObjectManager\ConfigLoader', [], [], '', false);
     $configLoader->expects($this->any())
         ->method('load')
         ->willReturn([]);
     $this->objectManager->expects($this->any())
         ->method('get')
         ->will($this->returnValueMap([
             ['Magento\Framework\App\State', $this->getMock('Magento\Framework\App\State', [], [], '', false)],
             ['Magento\Framework\ObjectManager\ConfigLoaderInterface', $configLoader],
         ]));
     $this->objectManager->expects($this->any())
         ->method('create')
         ->will($this->returnValueMap([
             ['Magento\Framework\Backup\Filesystem\Helper', [], $this->helper],
             ['Magento\Framework\Backup\Filesystem', [], $this->filesystem],
             ['Magento\Framework\Backup\Db', [], $this->database],
         ]));
     $this->model = new BackupRollback(
         $this->objectManager,
         $this->log,
         $this->directoryList,
         $this->file,
         $this->helper
     );
 }
開發者ID:robbiereynolds,項目名稱:magento2,代碼行數:44,代碼來源:BackupRollbackTest.php

示例6: testExecute

 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());
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:19,代碼來源:DiCompileCommandTest.php

示例7: testResolveSecurity

 public function testResolveSecurity()
 {
     $this->ruleMock->expects($this->once())->method('getPatternDirs')->willReturn(['var/test']);
     $directoryWeb = clone $this->directoryMock;
     $fileRead = clone $this->directoryMock;
     $this->directoryMock->expects($this->once())->method('isExist')->willReturn(true);
     $this->directoryListMock->expects($this->once())->method('getPath')->willReturn('lib_web');
     $this->readFactoryMock->expects($this->any())->method('create')->willReturnMap([['var/test', DriverPool::FILE, $this->directoryMock], ['lib_web', DriverPool::FILE, $directoryWeb], [false, DriverPool::FILE, $fileRead]]);
     $directoryWeb->expects($this->once())->method('getAbsolutePath')->willReturn('var/test/web');
     $fileRead->expects($this->once())->method('getAbsolutePath')->willReturn('var/test/web/css');
     $this->assertEquals('var/test/../file.ext', $this->object->resolve('type', '../file.ext', '', null, '', ''));
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:12,代碼來源:SimpleTest.php

示例8: _setupDirectoryListMock

 protected function _setupDirectoryListMock(array $config)
 {
     $this->_directoryListMock->expects($this->any())->method('getConfig')->will($this->returnValue($config));
 }
開發者ID:,項目名稱:,代碼行數:4,代碼來源:

示例9: testGetUri

 public function testGetUri()
 {
     $this->_directoryListMock->expects($this->once())->method('getUrlPath')->with('code')->willReturn('result');
     $this->assertEquals('result', $this->_filesystem->getUri('code'));
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:5,代碼來源:FilesystemTest.php

示例10: testIsDeployed

 public function testIsDeployed()
 {
     $this->directoryList->expects($this->once())->method('getPath')->with('code');
     $this->sampleDataInstall->isDeployed();
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:5,代碼來源:SampleDataTest.php


注:本文中的Magento\Framework\App\Filesystem\DirectoryList::expects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。