当前位置: 首页>>代码示例>>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;未经允许,请勿转载。