本文整理汇总了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');
}
示例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);
}
示例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
);
}
示例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);
}
示例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');
}