当前位置: 首页>>代码示例>>PHP>>正文


PHP Files::expects方法代码示例

本文整理汇总了PHP中Magento\Framework\App\Utility\Files::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::expects方法的具体用法?PHP Files::expects怎么用?PHP Files::expects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\App\Utility\Files的用法示例。


在下文中一共展示了Files::expects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetData

 /**
  * @return void
  */
 public function testGetData()
 {
     $themePath = 'blank';
     $areaCode = 'adminhtml';
     $files = [['path1'], ['path2']];
     $relativePathMap = [['path1' => 'relativePath1'], ['path2' => 'relativePath2']];
     $contentsMap = [['relativePath1' => 'content1$.mage.__("hello1")content1'], ['relativePath2' => 'content2$.mage.__("hello2")content2']];
     $patterns = ['~\\$\\.mage\\.__\\([\'|\\"](.+?)[\'|\\"]\\)~'];
     $this->appStateMock->expects($this->once())->method('getAreaCode')->willReturn($areaCode);
     $this->filesUtilityMock->expects($this->once())->method('getJsFiles')->with($areaCode, $themePath)->willReturn($files);
     $this->rootDirectoryMock->expects($this->any())->method('getRelativePath')->willReturnMap($relativePathMap);
     $this->rootDirectoryMock->expects($this->any())->method('readFile')->willReturnMap($contentsMap);
     $this->configMock->expects($this->any())->method('getPatterns')->willReturn($patterns);
     $this->assertEquals([], $this->model->getData($themePath));
 }
开发者ID:ddronald,项目名称:module-translation,代码行数:18,代码来源:DataProviderTest.php

示例2: testExecuteInvalidLanguageArgument

 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage ARG_IS_WRONG argument has invalid value, please run info:language:list
  */
 public function testExecuteInvalidLanguageArgument()
 {
     $this->filesUtil->expects(self::any())->method('getStaticPreProcessingFiles')->willReturn([]);
     $this->objectManager->expects($this->at(0))->method('create')->willReturn($this->filesUtil);
     $wrongParam = ['languages' => ['ARG_IS_WRONG']];
     $commandTester = new CommandTester($this->command);
     $commandTester->execute($wrongParam);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:DeployStaticContentCommandTest.php

示例3: testGetData

 /**
  * @return void
  */
 public function testGetData()
 {
     $themePath = 'blank';
     $areaCode = 'adminhtml';
     $filePaths = [['path1'], ['path2'], ['path3'], ['path4']];
     $jsFilesMap = [['base', $themePath, '*', '*', [$filePaths[0]]], [$areaCode, $themePath, '*', '*', [$filePaths[1]]]];
     $staticFilesMap = [['base', $themePath, '*', '*', [$filePaths[2]]], [$areaCode, $themePath, '*', '*', [$filePaths[3]]]];
     $expectedResult = ['hello1' => 'hello1translated', 'hello2' => 'hello2translated', 'hello3' => 'hello3translated', 'hello4' => 'hello4translated'];
     $contentsMap = ['content1$.mage.__("hello1")content1', 'content2$.mage.__("hello2")content2', 'content2$.mage.__("hello3")content3', 'content2$.mage.__("hello4")content4'];
     $translateMap = [[['hello1'], [], 'hello1translated'], [['hello2'], [], 'hello2translated'], [['hello3'], [], 'hello3translated'], [['hello4'], [], 'hello4translated']];
     $patterns = ['~\\$\\.mage\\.__\\(([\'"])(.+?)\\1\\)~'];
     $this->appStateMock->expects($this->once())->method('getAreaCode')->willReturn($areaCode);
     $this->filesUtilityMock->expects($this->any())->method('getJsFiles')->willReturnMap($jsFilesMap);
     $this->filesUtilityMock->expects($this->any())->method('getStaticHtmlFiles')->willReturnMap($staticFilesMap);
     foreach ($contentsMap as $index => $content) {
         $this->fileReadMock->expects($this->at($index))->method('readAll')->willReturn($content);
     }
     $this->configMock->expects($this->any())->method('getPatterns')->willReturn($patterns);
     $this->translateMock->expects($this->any())->method('render')->willReturnMap($translateMap);
     $this->assertEquals($expectedResult, $this->model->getData($themePath));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:24,代码来源:DataProviderTest.php


注:本文中的Magento\Framework\App\Utility\Files::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。