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