當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。