@@ -65,21 +65,17 @@ public function getTestsForParsePhpConstants()
65
65
];
66
66
}
67
67
68
- /**
69
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
70
- * @expectedExceptionMessage The constant "WRONG_CONSTANT" is not defined
71
- */
72
68
public function testParsePhpConstantThrowsExceptionWhenUndefined ()
73
69
{
70
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
71
+ $ this ->expectExceptionMessage ('The constant "WRONG_CONSTANT" is not defined ' );
74
72
Inline::parse ('!php/const WRONG_CONSTANT ' , Yaml::PARSE_CONSTANT );
75
73
}
76
74
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
- */
81
75
public function testParsePhpConstantThrowsExceptionOnInvalidType ()
82
76
{
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.*# ' );
83
79
Inline::parse ('!php/const PHP_INT_MAX ' , Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE );
84
80
}
85
81
@@ -152,46 +148,36 @@ public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedTo
152
148
$ this ->assertSame ($ value , Inline::parse (Inline::dump ($ value )));
153
149
}
154
150
155
- /**
156
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
157
- * @expectedExceptionMessage Found unknown escape character "\V".
158
- */
159
151
public function testParseScalarWithNonEscapedBlackslashShouldThrowException ()
160
152
{
153
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
154
+ $ this ->expectExceptionMessage ('Found unknown escape character "\V". ' );
161
155
Inline::parse ('"Foo\Var" ' );
162
156
}
163
157
164
- /**
165
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
166
- */
167
158
public function testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException ()
168
159
{
160
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
169
161
Inline::parse ('"Foo \\" ' );
170
162
}
171
163
172
- /**
173
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
174
- */
175
164
public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException ()
176
165
{
166
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
177
167
$ value = "'don't do somthin' like that' " ;
178
168
Inline::parse ($ value );
179
169
}
180
170
181
- /**
182
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
183
- */
184
171
public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException ()
185
172
{
173
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
186
174
$ value = '"don"t do somthin" like that" ' ;
187
175
Inline::parse ($ value );
188
176
}
189
177
190
- /**
191
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
192
- */
193
178
public function testParseInvalidMappingKeyShouldThrowException ()
194
179
{
180
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
195
181
$ value = '{ "foo " bar": "bar" } ' ;
196
182
Inline::parse ($ value );
197
183
}
@@ -206,19 +192,15 @@ public function testParseMappingKeyWithColonNotFollowedBySpace()
206
192
Inline::parse ('{1:""} ' );
207
193
}
208
194
209
- /**
210
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
211
- */
212
195
public function testParseInvalidMappingShouldThrowException ()
213
196
{
197
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
214
198
Inline::parse ('[foo] bar ' );
215
199
}
216
200
217
- /**
218
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
219
- */
220
201
public function testParseInvalidSequenceShouldThrowException ()
221
202
{
203
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
222
204
Inline::parse ('{ foo: bar } bar ' );
223
205
}
224
206
@@ -284,21 +266,17 @@ public function testParseMapReferenceInSequenceAsFifthArgument()
284
266
$ this ->assertSame ([$ foo ], Inline::parse ('[*foo] ' , false , false , false , ['foo ' => $ foo ]));
285
267
}
286
268
287
- /**
288
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
289
- * @expectedExceptionMessage A reference must contain at least one character at line 1.
290
- */
291
269
public function testParseUnquotedAsterisk ()
292
270
{
271
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
272
+ $ this ->expectExceptionMessage ('A reference must contain at least one character at line 1. ' );
293
273
Inline::parse ('{ foo: * } ' );
294
274
}
295
275
296
- /**
297
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
298
- * @expectedExceptionMessage A reference must contain at least one character at line 1.
299
- */
300
276
public function testParseUnquotedAsteriskFollowedByAComment ()
301
277
{
278
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
279
+ $ this ->expectExceptionMessage ('A reference must contain at least one character at line 1. ' );
302
280
Inline::parse ('{ foo: * #foo } ' );
303
281
}
304
282
@@ -688,10 +666,10 @@ public function getBinaryData()
688
666
689
667
/**
690
668
* @dataProvider getInvalidBinaryData
691
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
692
669
*/
693
670
public function testParseInvalidBinaryData ($ data , $ expectedMessage )
694
671
{
672
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
695
673
$ this ->expectExceptionMessageRegExp ($ expectedMessage );
696
674
697
675
Inline::parse ($ data );
@@ -707,12 +685,10 @@ public function getInvalidBinaryData()
707
685
];
708
686
}
709
687
710
- /**
711
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
712
- * @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported} at line 1.
713
- */
714
688
public function testNotSupportedMissingValue ()
715
689
{
690
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
691
+ $ this ->expectExceptionMessage ('Malformed inline YAML string: {this, is not, supported} at line 1. ' );
716
692
Inline::parse ('{this, is not, supported} ' );
717
693
}
718
694
@@ -796,12 +772,10 @@ public function testDeprecatedStrTag()
796
772
$ this ->assertSame (['foo ' => 'bar ' ], Inline::parse ('{ foo: !str bar } ' ));
797
773
}
798
774
799
- /**
800
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
801
- * @expectedExceptionMessage Unexpected end of line, expected one of ",}" at line 1 (near "{abc: 'def'").
802
- */
803
775
public function testUnfinishedInlineMap ()
804
776
{
777
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
778
+ $ this ->expectExceptionMessage ('Unexpected end of line, expected one of ",}" at line 1 (near "{abc: \'def \'"). ' );
805
779
Inline::parse ("{abc: 'def' " );
806
780
}
807
781
}
0 commit comments