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


PHP Data::expects方法代码示例

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


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

示例1: testGetConfigurationCountryCodeFromDefault

 /**
  * @param string|null $request
  * @param string|null|false $config
  * @param string|null $default
  * @dataProvider getConfigurationCountryCodeFromDefaultDataProvider
  */
 public function testGetConfigurationCountryCodeFromDefault($request, $config, $default)
 {
     $this->_configurationCountryCodePrepareRequest($request);
     $this->_configurationCountryCodePrepareConfig($config);
     $this->directoryHelperMock->expects($this->once())->method('getDefaultCountry')->will($this->returnValue($default));
     $this->_configurationCountryCodeAssertResult($default);
 }
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:BackendTest.php

示例2: testValidateValue

 /**
  * @param string $value to assign to boolean
  * @param bool $expected text output
  * @param string $countryId
  * @param bool $isOptional
  *
  * @dataProvider validateValueDataProvider
  */
 public function testValidateValue($value, $expected, $countryId, $isOptional)
 {
     $storeLabel = 'Zip/Postal Code';
     $this->attributeMetadataMock->expects($this->once())->method('getStoreLabel')->willReturn($storeLabel);
     $this->directoryHelper->expects($this->once())->method('isZipCodeOptional')->willReturnMap([[$countryId, $isOptional]]);
     $object = $this->getClass($value);
     $object->setExtractedData(['country_id' => $countryId]);
     $actual = $object->validateValue($value);
     $this->assertEquals($expected, $actual);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:PostcodeTest.php

示例3: testValidateValue

 /**
  * @param string $value to assign to boolean
  * @param bool $expected text output
  * @param string $countryId
  * @param bool $isOptional
  *
  * @dataProvider validateValueDataProvider
  */
 public function testValidateValue($value, $expected, $countryId, $isOptional)
 {
     $storeLabel = 'Zip/Postal Code';
     $this->attributeMock->expects($this->once())->method('getStoreLabel')->willReturn($storeLabel);
     $this->directoryHelperMock->expects($this->once())->method('isZipCodeOptional')->willReturnMap([[$countryId, $isOptional]]);
     $object = new \Magento\Customer\Model\Attribute\Data\Postcode($this->localeMock, $this->loggerMock, $this->localeResolverMock, $this->directoryHelperMock);
     $object->setAttribute($this->attributeMock);
     $object->setExtractedData(['country_id' => $countryId]);
     $actual = $object->validateValue($value);
     $this->assertEquals($expected, $actual);
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:19,代码来源:PostcodeTest.php

示例4: testValidate

 /**
  * @param $data
  * @param $expected
  *
  * @dataProvider validateDataProvider
  */
 public function testValidate($data, $expected)
 {
     $this->directoryDataMock->expects($this->once())->method('getCountriesWithOptionalZip')->will($this->returnValue([]));
     $this->directoryDataMock->expects($this->never())->method('isRegionRequired');
     $this->model->setData($data);
     $this->assertEquals($expected, $this->model->validate());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:AbstractAddressTest.php

示例5: testGetBmlDisplay

 /**
  * @dataProvider dataProviderGetBmlDisplay
  */
 public function testGetBmlDisplay($section, $expectedValue, $expectedFlag, $expected)
 {
     $this->_model->setStoreId(1);
     $this->directoryHelper->expects($this->any())->method('getDefaultCountry')->with(1)->will($this->returnValue('US'));
     $this->_scopeConfig->expects($this->any())->method('isSetFlag')->will($this->returnValue($expectedFlag));
     $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValueMap([['payment/' . Config::METHOD_WPP_BML . '/' . $section . '_display', 'store', 1, $expectedValue], ['payment/' . Config::METHOD_WPP_BML . '/active', 'store', 1, $expectedValue], ['payment/' . Config::METHOD_WPP_PE_BML . '/active', 'store', 1, $expectedValue]]));
     $this->assertEquals($expected, $this->_model->getBmlDisplay($section));
 }
开发者ID:nja78,项目名称:magento2,代码行数:11,代码来源:ConfigTest.php

示例6: prepareMocksForInvalidAddressValidation

 protected function prepareMocksForInvalidAddressValidation()
 {
     $countryModel = $this->getMock('Magento\\Directory\\Model\\Country', [], [], '', false);
     $regionCollection = $this->getMock('Magento\\Directory\\Model\\ResourceModel\\Region\\Collection', [], [], '', false);
     $this->address->expects($this->once())->method('getShouldIgnoreValidation')->willReturn(false);
     $this->address->expects($this->atLeastOnce())->method('getCountryId');
     $this->address->expects($this->once())->method('getFirstname');
     $this->address->expects($this->once())->method('getLastname');
     $this->address->expects($this->once())->method('getStreetLine')->with(1);
     $this->address->expects($this->once())->method('getCity');
     $this->address->expects($this->once())->method('getTelephone');
     $this->address->expects($this->once())->method('getRegionId')->willReturn(null);
     $this->directoryData->expects($this->once())->method('getCountriesWithOptionalZip')->willReturn([]);
     $this->address->expects($this->once())->method('getCountryModel')->willReturn($countryModel);
     $countryModel->expects($this->once())->method('getRegionCollection')->willReturn($regionCollection);
     $regionCollection->expects($this->once())->method('getSize')->willReturn(2);
     $this->directoryData->expects($this->once())->method('isRegionRequired')->with(null)->willReturn(true);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:AddressRepositoryTest.php

示例7: testGetWebsites

 public function testGetWebsites()
 {
     $this->directoryHelperMock->expects($this->once())->method('getBaseCurrencyCode')->willReturn('USD');
     $this->storeManagerMock->expects($this->once())->method('hasSingleStore')->willReturn(true);
     $this->assertSame([['value' => 0, 'label' => 'All Websites USD']], $this->model->getWebsites($this->productMock, $this->eavAttributeMock));
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:6,代码来源:WebsiteTest.php


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