Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setPostalCodeRequired example
public
function
testInValidZipcodeIsRequired
(
)
: void
{
$countryId
=
$this
->constraint->countryId;
static
::
assertNotNull
(
$countryId
)
;
$result
=
$this
->
createMock
(
EntitySearchResult::
class
)
;
$country
=
new
CountryEntity
(
)
;
$country
->
setIso
(
'DE'
)
;
$country
->
setId
(
$countryId
)
;
$country
->
setPostalCodeRequired
(
true
)
;
$country
->
setCheckPostalCodePattern
(
false
)
;
$country
->
setCheckAdvancedPostalCodePattern
(
false
)
;
$country
->
setDefaultPostalCodePattern
(
'\\d{5}'
)
;
$country
->
setAdvancedPostalCodePattern
(
null
)
;
$result
->
method
(
'get'
)
->
with
(
$countryId
)
->
willReturn
(
$country
)
;
$this
->countryRepository->
expects
(
static
::
once
(
)
)
->
method
(
'search'
)
->
willReturn
(
$result
)
;
$executionContext
=
$this
->
createMock
(
ExecutionContext::
class
)
;
$executionContext
->
expects
(
static
::
once
(
)
)
->
method
(
'buildViolation'
)
->
willReturnCallback
(
function
Dstring
$message
, array
$parameters
=
[
]
)
{