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


PHP Value::expects方法代码示例

本文整理汇总了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));
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:9,代码来源:ValueProcessorTest.php

示例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]));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:ValueProcessorTest.php

示例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));
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:15,代码来源:BackendModelFactoryTest.php

示例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);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:20,代码来源:ThemeValidatorTest.php


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