本文整理汇总了PHP中Magento\Framework\App\Config\Value::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Value::expects方法的具体用法?PHP Value::expects怎么用?PHP Value::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Config\Value
的用法示例。
在下文中一共展示了Value::expects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProcess
public function testProcess()
{
$path = 'design/head/logo';
$value = 'path/to/logo';
$this->backendModelFactory->expects($this->once())->method('createByPath')->with($path, ['value' => $value])->willReturn($this->backendModel);
$this->backendModel->expects($this->once())->method('afterLoad');
$this->backendModel->expects($this->once())->method('getValue')->willReturn($value);
$this->assertEquals($value, $this->valueProcessor->process($value, $path));
}
示例2: testProcess
public function testProcess()
{
$path = 'design/head/logo';
$value = 'path/to/logo';
$scope = 'websites';
$scopeId = 1;
$this->backendModelFactory->expects($this->once())->method('createByPath')->with($path, ['value' => $value, 'field_config' => ['path' => $path], 'scope' => $scope, 'scope_id' => $scopeId])->willReturn($this->backendModel);
$this->backendModel->expects($this->once())->method('afterLoad');
$this->backendModel->expects($this->once())->method('getValue')->willReturn($value);
$this->assertEquals($value, $this->valueProcessor->process($value, $scope, $scopeId, ['path' => $path]));
}
示例3: testCreate
public function testCreate()
{
$scope = 'website';
$scopeId = 1;
$data = ['scope' => $scope, 'scopeId' => $scopeId, 'value' => 'value', 'config' => ['path' => 'design/head/default_title', 'backend_model' => 'Magento\\Framework\\App\\Config\\Value']];
$this->metadataProviderMock->expects($this->once())->method('get')->willReturn(['head_default_title' => ['path' => 'design/head/default_title']]);
$this->collectionFactoryMock->expects($this->once())->method('create')->willReturn($this->collection);
$this->collection->expects($this->once())->method('addPathsFilter')->with(['head_default_title' => 'design/head/default_title']);
$this->collection->expects($this->once())->method('addFieldToFilter')->with('scope', $scope);
$this->collection->expects($this->once())->method('addScopeIdFilter')->with($scopeId);
$this->collection->expects($this->once())->method('getData')->willReturn([['config_id' => 1, 'path' => 'design/head/default_title']]);
$this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Framework\\App\\Config\\Value', ['data' => ['path' => 'design/head/default_title', 'scope' => $scope, 'scope_id' => $scopeId, 'field_config' => $data['config'], 'config_id' => 1]])->willReturn($this->backendModel);
$this->backendModel->expects($this->once())->method('setValue')->willReturn('value');
$this->assertSame($this->backendModel, $this->model->create($data));
}
示例4: testValidateIsThemeInUse
public function testValidateIsThemeInUse()
{
$theme = $this->getMock('Magento\\Theme\\Model\\Theme', [], [], '', false);
$theme->expects($this->once())->method('getId')->willReturn(6);
$defaultEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope' => 'default', 'scope_id' => 8]);
$websitesEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope' => 'websites', 'scope_id' => 8]);
$storesEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope' => 'stores', 'scope_id' => 8]);
$this->themeProvider->expects($this->once())->method('getThemeByFullPath')->willReturn($theme);
$this->configData->expects($this->once())->method('getCollection')->willReturn($this->configData);
$this->configData->expects($this->at(1))->method('addFieldToFilter')->willReturn($this->configData);
$this->configData->expects($this->at(2))->method('addFieldToFilter')->willReturn([$defaultEntity, $websitesEntity, $storesEntity]);
$website = $this->getMock('Magento\\Store\\Model\\Website', ['getName'], [], '', false);
$website->expects($this->once())->method('getName')->willReturn('websiteA');
$store = $this->getMock('Magento\\Store\\Model\\Store', ['getName'], [], '', false);
$store->expects($this->once())->method('getName')->willReturn('storeA');
$this->storeManager->expects($this->once())->method('getWebsite')->willReturn($website);
$this->storeManager->expects($this->once())->method('getStore')->willReturn($store);
$result = $this->themeValidator->validateIsThemeInUse(['frontend/Magento/a']);
$this->assertEquals(['<error>frontend/Magento/a is in use in default config</error>', '<error>frontend/Magento/a is in use in website websiteA</error>', '<error>frontend/Magento/a is in use in store storeA</error>'], $result);
}