Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getCountryCodes example
public
function
testForCountryCodeAvailability
(
string
$country
)
{
// ensure each country code has a list of timezone identifiers (possibly empty) Timezones::
forCountryCode
(
$country
)
;
$this
->
addToAssertionCount
(
1
)
;
}
public
static
function
provideCountries
(
)
: iterable
{
return
array_map
(
fn
(
$country
)
=>
[
$country
]
, Countries::
getCountryCodes
(
)
)
;
}
public
function
testGetRawOffsetChangeTimeCountry
(
)
{
$this
->
assertSame
(
7200, Timezones::
getRawOffset
(
'Europe/Paris',
(
new
\
DateTimeImmutable
(
'2022-07-16 00:00:00+00:00'
)
)
->
getTimestamp
(
)
)
)
;
$this
->
assertSame
(
3600, Timezones::
getRawOffset
(
'Europe/Paris',
(
new
\
DateTimeImmutable
(
'2022-02-16 00:00:00+00:00'
)
)
->
getTimestamp
(
)
)
)
;
}
}
'XY' => '997',
'XZ' => '998',
'YE' => '887',
'YT' => '175',
'ZA' => '710',
'ZM' => '894',
'ZW' => '716',
]
;
public
function
testGetCountryCodes
(
)
{
$this
->
assertSame
(
self::COUNTRIES, Countries::
getCountryCodes
(
)
)
;
}
/** * @dataProvider provideLocales */
public
function
testGetNames
(
$displayLocale
)
{
$countries
=
array_keys
(
Countries::
getNames
(
$displayLocale
)
)
;
sort
(
$countries
)
;