@@ -65,21 +65,17 @@ public function getTestsForParsePhpConstants()
6565 ];
6666 }
6767
68- /**
69- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
70- * @expectedExceptionMessage The constant "WRONG_CONSTANT" is not defined
71- */
7268 public function testParsePhpConstantThrowsExceptionWhenUndefined ()
7369 {
70+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
71+ $ this ->expectExceptionMessage ('The constant "WRONG_CONSTANT" is not defined ' );
7472 Inline::parse ('!php/const WRONG_CONSTANT ' , Yaml::PARSE_CONSTANT );
7573 }
7674
77- /**
78- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
79- * @expectedExceptionMessageRegExp #The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#
80- */
8175 public function testParsePhpConstantThrowsExceptionOnInvalidType ()
8276 {
77+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
78+ $ this ->expectExceptionMessageRegExp ('#The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*# ' );
8379 Inline::parse ('!php/const PHP_INT_MAX ' , Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE );
8480 }
8581
@@ -152,46 +148,36 @@ public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedTo
152148 $ this ->assertSame ($ value , Inline::parse (Inline::dump ($ value )));
153149 }
154150
155- /**
156- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
157- * @expectedExceptionMessage Found unknown escape character "\V".
158- */
159151 public function testParseScalarWithNonEscapedBlackslashShouldThrowException ()
160152 {
153+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
154+ $ this ->expectExceptionMessage ('Found unknown escape character "\V". ' );
161155 Inline::parse ('"Foo\Var" ' );
162156 }
163157
164- /**
165- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
166- */
167158 public function testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException ()
168159 {
160+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
169161 Inline::parse ('"Foo \\" ' );
170162 }
171163
172- /**
173- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
174- */
175164 public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException ()
176165 {
166+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
177167 $ value = "'don't do somthin' like that' " ;
178168 Inline::parse ($ value );
179169 }
180170
181- /**
182- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
183- */
184171 public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException ()
185172 {
173+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
186174 $ value = '"don"t do somthin" like that" ' ;
187175 Inline::parse ($ value );
188176 }
189177
190- /**
191- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
192- */
193178 public function testParseInvalidMappingKeyShouldThrowException ()
194179 {
180+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
195181 $ value = '{ "foo " bar": "bar" } ' ;
196182 Inline::parse ($ value );
197183 }
@@ -206,19 +192,15 @@ public function testParseMappingKeyWithColonNotFollowedBySpace()
206192 Inline::parse ('{1:""} ' );
207193 }
208194
209- /**
210- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
211- */
212195 public function testParseInvalidMappingShouldThrowException ()
213196 {
197+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
214198 Inline::parse ('[foo] bar ' );
215199 }
216200
217- /**
218- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
219- */
220201 public function testParseInvalidSequenceShouldThrowException ()
221202 {
203+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
222204 Inline::parse ('{ foo: bar } bar ' );
223205 }
224206
@@ -284,21 +266,17 @@ public function testParseMapReferenceInSequenceAsFifthArgument()
284266 $ this ->assertSame ([$ foo ], Inline::parse ('[*foo] ' , false , false , false , ['foo ' => $ foo ]));
285267 }
286268
287- /**
288- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
289- * @expectedExceptionMessage A reference must contain at least one character at line 1.
290- */
291269 public function testParseUnquotedAsterisk ()
292270 {
271+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
272+ $ this ->expectExceptionMessage ('A reference must contain at least one character at line 1. ' );
293273 Inline::parse ('{ foo: * } ' );
294274 }
295275
296- /**
297- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
298- * @expectedExceptionMessage A reference must contain at least one character at line 1.
299- */
300276 public function testParseUnquotedAsteriskFollowedByAComment ()
301277 {
278+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
279+ $ this ->expectExceptionMessage ('A reference must contain at least one character at line 1. ' );
302280 Inline::parse ('{ foo: * #foo } ' );
303281 }
304282
@@ -688,10 +666,10 @@ public function getBinaryData()
688666
689667 /**
690668 * @dataProvider getInvalidBinaryData
691- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
692669 */
693670 public function testParseInvalidBinaryData ($ data , $ expectedMessage )
694671 {
672+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
695673 $ this ->expectExceptionMessageRegExp ($ expectedMessage );
696674
697675 Inline::parse ($ data );
@@ -707,12 +685,10 @@ public function getInvalidBinaryData()
707685 ];
708686 }
709687
710- /**
711- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
712- * @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported} at line 1.
713- */
714688 public function testNotSupportedMissingValue ()
715689 {
690+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
691+ $ this ->expectExceptionMessage ('Malformed inline YAML string: {this, is not, supported} at line 1. ' );
716692 Inline::parse ('{this, is not, supported} ' );
717693 }
718694
@@ -796,12 +772,10 @@ public function testDeprecatedStrTag()
796772 $ this ->assertSame (['foo ' => 'bar ' ], Inline::parse ('{ foo: !str bar } ' ));
797773 }
798774
799- /**
800- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
801- * @expectedExceptionMessage Unexpected end of line, expected one of ",}" at line 1 (near "{abc: 'def'").
802- */
803775 public function testUnfinishedInlineMap ()
804776 {
777+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
778+ $ this ->expectExceptionMessage ('Unexpected end of line, expected one of ",}" at line 1 (near "{abc: \'def \'"). ' );
805779 Inline::parse ("{abc: 'def' " );
806780 }
807781}
0 commit comments