@@ -106,7 +106,7 @@ public function getValidGroupedTimezones(): iterable
106106 /**
107107 * @dataProvider getInvalidTimezones
108108 */
109- public function testInvalidTimezonesWithoutZone (string $ timezone, string $ zoneMessage , string $ countryCodeMessage )
109+ public function testInvalidTimezonesWithoutZone (string $ timezone )
110110 {
111111 $ constraint = new Timezone (array (
112112 'message ' => 'myMessage ' ,
@@ -115,25 +115,24 @@ public function testInvalidTimezonesWithoutZone(string $timezone, string $zoneMe
115115 $ this ->validator ->validate ($ timezone , $ constraint );
116116
117117 $ this ->buildViolation ('myMessage ' )
118- ->setParameter ('{{ zone_message }} ' , $ zoneMessage )
119- ->setParameter ('{{ country_code_message }} ' , $ countryCodeMessage )
118+ ->setParameter ('{{ value }} ' , '" ' .$ timezone .'" ' )
120119 ->setCode (Timezone::NO_SUCH_TIMEZONE_ERROR )
121120 ->assertRaised ();
122121 }
123122
124123 public function getInvalidTimezones (): iterable
125124 {
126125 return array (
127- array ('Buenos_Aires/Argentina/America ' , '' , '' ),
128- array ('Mayotte/Indian ' , '' , '' ),
129- array ('foobar ' , '' , '' ),
126+ array ('Buenos_Aires/Argentina/America ' ),
127+ array ('Mayotte/Indian ' ),
128+ array ('foobar ' ),
130129 );
131130 }
132131
133132 /**
134133 * @dataProvider getInvalidGroupedTimezones
135134 */
136- public function testInvalidGroupedTimezones (string $ timezone , int $ what, string $ zoneMessage , string $ countryCodeMessage )
135+ public function testInvalidGroupedTimezones (string $ timezone , int $ what )
137136 {
138137 $ constraint = new Timezone (array (
139138 'zone ' => $ what ,
@@ -143,20 +142,19 @@ public function testInvalidGroupedTimezones(string $timezone, int $what, string
143142 $ this ->validator ->validate ($ timezone , $ constraint );
144143
145144 $ this ->buildViolation ('myMessage ' )
146- ->setParameter ('{{ zone_message }} ' , $ zoneMessage )
147- ->setParameter ('{{ country_code_message }} ' , $ countryCodeMessage )
145+ ->setParameter ('{{ value }} ' , '" ' .$ timezone .'" ' )
148146 ->setCode (Timezone::NO_SUCH_TIMEZONE_IN_ZONE_ERROR )
149147 ->assertRaised ();
150148 }
151149
152150 public function getInvalidGroupedTimezones (): iterable
153151 {
154152 return array (
155- array ('Antarctica/McMurdo ' , \DateTimeZone::AMERICA , ' at "AMERICA" zone ' , '' ),
156- array ('America/Barbados ' , \DateTimeZone::ANTARCTICA , ' at "ANTARCTICA" zone ' , '' ),
157- array ('Europe/Kiev ' , \DateTimeZone::ARCTIC , ' at "ARCTIC" zone ' , '' ),
158- array ('Asia/Ho_Chi_Minh ' , \DateTimeZone::INDIAN , ' at "INDIAN" zone ' , '' ),
159- array ('Asia/Ho_Chi_Minh ' , \DateTimeZone::INDIAN | \DateTimeZone::ANTARCTICA , ' at zone with identifier 260 ' , '' ),
153+ array ('Antarctica/McMurdo ' , \DateTimeZone::AMERICA ),
154+ array ('America/Barbados ' , \DateTimeZone::ANTARCTICA ),
155+ array ('Europe/Kiev ' , \DateTimeZone::ARCTIC ),
156+ array ('Asia/Ho_Chi_Minh ' , \DateTimeZone::INDIAN ),
157+ array ('Asia/Ho_Chi_Minh ' , \DateTimeZone::INDIAN | \DateTimeZone::ANTARCTICA ),
160158 );
161159 }
162160
@@ -197,7 +195,7 @@ public function getValidGroupedTimezonesByCountry(): iterable
197195 /**
198196 * @dataProvider getInvalidGroupedTimezonesByCountry
199197 */
200- public function testInvalidGroupedTimezonesByCountry (string $ timezone , int $ what , string $ country, string $ zoneMessage , string $ countryCodeMessage )
198+ public function testInvalidGroupedTimezonesByCountry (string $ timezone , int $ what , string $ country )
201199 {
202200 $ constraint = new Timezone (array (
203201 'message ' => 'myMessage ' ,
@@ -208,17 +206,16 @@ public function testInvalidGroupedTimezonesByCountry(string $timezone, int $what
208206 $ this ->validator ->validate ($ timezone , $ constraint );
209207
210208 $ this ->buildViolation ('myMessage ' )
211- ->setParameter ('{{ zone_message }} ' , $ zoneMessage )
212- ->setParameter ('{{ country_code_message }} ' , $ countryCodeMessage )
209+ ->setParameter ('{{ value }} ' , '" ' .$ timezone .'" ' )
213210 ->setCode (Timezone::NO_SUCH_TIMEZONE_IN_COUNTRY_ERROR )
214211 ->assertRaised ();
215212 }
216213
217214 public function getInvalidGroupedTimezonesByCountry (): iterable
218215 {
219216 return array (
220- array ('America/Argentina/Cordoba ' , \DateTimeZone::PER_COUNTRY , 'FR ' , '' , ' for ISO 3166-1 country code "FR" ' ),
221- array ('America/Barbados ' , \DateTimeZone::PER_COUNTRY , 'PT ' , '' , ' for ISO 3166-1 country code "PT" ' ),
217+ array ('America/Argentina/Cordoba ' , \DateTimeZone::PER_COUNTRY , 'FR ' ),
218+ array ('America/Barbados ' , \DateTimeZone::PER_COUNTRY , 'PT ' ),
222219 );
223220 }
224221
@@ -248,8 +245,7 @@ public function testDeprecatedTimezonesAreInvaildWithoutBC(string $timezone)
248245 $ this ->validator ->validate ($ timezone , $ constraint );
249246
250247 $ this ->buildViolation ('myMessage ' )
251- ->setParameter ('{{ zone_message }} ' , '' )
252- ->setParameter ('{{ country_code_message }} ' , '' )
248+ ->setParameter ('{{ value }} ' , '" ' .$ timezone .'" ' )
253249 ->setCode (Timezone::NO_SUCH_TIMEZONE_ERROR )
254250 ->assertRaised ();
255251 }
0 commit comments