23 $this->directoryHelper = $this->getMockBuilder(\
Magento\Directory\Helper\Data::class)
24 ->disableOriginalConstructor()
36 return new \Magento\Customer\Model\Metadata\Form\Postcode(
39 $this->attributeMetadataMock,
40 $this->localeResolverMock,
44 $this->directoryHelper
58 $storeLabel =
'Zip/Postal Code';
59 $this->attributeMetadataMock->expects($this->once())
60 ->method(
'getStoreLabel')
61 ->willReturn($storeLabel);
63 $this->directoryHelper->expects($this->once())
64 ->method(
'isZipCodeOptional')
66 [$countryId, $isOptional],
70 $object->setExtractedData([
'country_id' => $countryId]);
72 $actual = $object->validateValue(
$value);
73 $this->assertEquals($expected, $actual);
82 [
'', [
'"Zip/Postal Code" is a required value.'],
'US',
false],
83 [
'90034',
true,
'US',
false],
84 [
'',
true,
'IE',
true],
85 [
'90034',
true,
'IE',
true],
validateValueDataProvider()
testValidateValue($value, $expected, $countryId, $isOptional)