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


PHP ComponentRegistrar::expects方法代码示例

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


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

示例1: testGetPackageNameInvalidJson

 /**
  * @expectedException \Zend_Json_Exception
  */
 public function testGetPackageNameInvalidJson()
 {
     $this->componentRegistrar->expects($this->once())->method('getPath')->willReturn('path/to/A');
     $this->dirRead->expects($this->once())->method('isExist')->willReturn(true);
     $this->dirRead->expects($this->once())->method('readFile')->willReturn('{"name": }');
     $this->themePackageInfo->getPackageName('themeA');
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:ThemePackageInfoTest.php

示例2: setUp

 public function setUp()
 {
     $this->componentRegistrar = $this->getMock('Magento\\Framework\\Component\\ComponentRegistrar', [], [], '', false);
     $this->reader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', [], [], '', false);
     $this->componentRegistrar->expects($this->once())->method('getPaths')->will($this->returnValue(['A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E']));
     $composerData = ['A/composer.json' => '{"name":"a", "require":{"b":"0.1"}, "conflict":{"c":"0.1"}, "version":"0.1"}', 'B/composer.json' => '{"name":"b", "require":{"d":"0.3"}, "version":"0.2"}', 'C/composer.json' => '{"name":"c", "require":{"e":"0.1"}, "version":"0.1"}', 'D/composer.json' => '{"name":"d", "conflict":{"c":"0.1"}, "version":"0.3"}', 'E/composer.json' => '{"name":"e", "version":"0.4"}'];
     $fileIteratorMock = $this->getMock('Magento\\Framework\\Config\\FileIterator', [], [], '', false);
     $fileIteratorMock->expects($this->once())->method('toArray')->will($this->returnValue($composerData));
     $this->reader->expects($this->once())->method('getComposerJsonFiles')->will($this->returnValue($fileIteratorMock));
     $this->packageInfo = new PackageInfo($this->reader, $this->componentRegistrar);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:PackageInfoTest.php

示例3: setUp

    public function setUp()
    {
        $this->deploymentConfig = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false);
        $objectManagerProvider = $this->getMock(
            'Magento\Setup\Model\ObjectManagerProvider',
            [],
            [],
            '',
            false
        );
        $this->objectManager = $this->getMockForAbstractClass(
            'Magento\Framework\ObjectManagerInterface',
            [],
            '',
            false
        );
        $this->cacheMock = $this->getMockBuilder('Magento\Framework\App\Cache')
            ->disableOriginalConstructor()
            ->getMock();

        $objectManagerProvider->expects($this->once())
            ->method('get')
            ->willReturn($this->objectManager);
        $this->manager = $this->getMock('Magento\Setup\Module\Di\App\Task\Manager', [], [], '', false);
        $this->directoryList = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false);
        $this->filesystem = $this->getMockBuilder('Magento\Framework\Filesystem')
            ->disableOriginalConstructor()
            ->getMock();

        $this->fileDriver = $this->getMockBuilder('Magento\Framework\Filesystem\Driver\File')
            ->disableOriginalConstructor()
            ->getMock();
        $this->componentRegistrar = $this->getMock(
            '\Magento\Framework\Component\ComponentRegistrar',
            [],
            [],
            '',
            false
        );
        $this->componentRegistrar->expects($this->any())->method('getPaths')->willReturnMap([
            [ComponentRegistrar::MODULE, ['/path/to/module/one', '/path/to/module/two']],
            [ComponentRegistrar::LIBRARY, ['/path/to/library/one', '/path/to/library/two']],
        ]);

        $this->command = new DiCompileCommand(
            $this->deploymentConfig,
            $this->directoryList,
            $this->manager,
            $objectManagerProvider,
            $this->filesystem,
            $this->fileDriver,
            $this->componentRegistrar
        );
    }
开发者ID:rafaelstz,项目名称:magento2,代码行数:54,代码来源:DiCompileCommandTest.php

示例4: setUp

 /**
  * Test Setup
  *
  * @return void
  */
 public function setUp()
 {
     $this->_fileSystemMock = $this->getMock('\\Magento\\Framework\\Filesystem', [], [], '', false);
     $this->_scopeConfigMock = $this->getMock('\\Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->rootDirectoryMock = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\ReadInterface');
     $this->compiledDirectoryMock = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\ReadInterface');
     $this->_fileSystemMock->expects($this->any())->method('getDirectoryRead')->will($this->returnValueMap([[DirectoryList::ROOT, DriverPool::FILE, $this->rootDirectoryMock], [DirectoryList::TEMPLATE_MINIFICATION_DIR, DriverPool::FILE, $this->compiledDirectoryMock]]));
     $this->compiledDirectoryMock->expects($this->any())->method('getAbsolutePath')->will($this->returnValue('/magento/var/compiled'));
     $this->componentRegistrar = $this->getMock('Magento\\Framework\\Component\\ComponentRegistrar', [], [], '', false);
     $this->componentRegistrar->expects($this->any())->method('getPaths')->will($this->returnValueMap([[ComponentRegistrar::MODULE, ['/magento/app/code/Some/Module']], [ComponentRegistrar::THEME, ['/magento/themes/default']]]));
     $this->_validator = new \Magento\Framework\View\Element\Template\File\Validator($this->_fileSystemMock, $this->_scopeConfigMock, $this->componentRegistrar);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:ValidatorTest.php

示例5: testBuildPathToLocaleDirectoryByContextWithInvalidType

 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Invalid context given: "invalid_type".
  */
 public function testBuildPathToLocaleDirectoryByContextWithInvalidType()
 {
     $this->componentRegistrar->expects($this->any())->method('getPaths')->with(ComponentRegistrar::MODULE)->willReturn(['module' => '/path/to/module']);
     $this->context = new Context($this->componentRegistrar);
     $this->context->buildPathToLocaleDirectoryByContext('invalid_type', 'Magento_Module');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:10,代码来源:ContextTest.php


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