@@ -66,21 +66,17 @@ public function getTestsForParsePhpConstants()
66
66
];
67
67
}
68
68
69
- /**
70
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
71
- * @expectedExceptionMessage The constant "WRONG_CONSTANT" is not defined
72
- */
73
69
public function testParsePhpConstantThrowsExceptionWhenUndefined ()
74
70
{
71
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
72
+ $ this ->expectExceptionMessage ('The constant "WRONG_CONSTANT" is not defined ' );
75
73
Inline::parse ('!php/const WRONG_CONSTANT ' , Yaml::PARSE_CONSTANT );
76
74
}
77
75
78
- /**
79
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
80
- * @expectedExceptionMessageRegExp #The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#
81
- */
82
76
public function testParsePhpConstantThrowsExceptionOnInvalidType ()
83
77
{
78
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
79
+ $ this ->expectExceptionMessageRegExp ('#The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*# ' );
84
80
Inline::parse ('!php/const PHP_INT_MAX ' , Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE );
85
81
}
86
82
@@ -121,72 +117,56 @@ public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedTo
121
117
$ this ->assertSame ($ value , Inline::parse (Inline::dump ($ value )));
122
118
}
123
119
124
- /**
125
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
126
- * @expectedExceptionMessage Found unknown escape character "\V".
127
- */
128
120
public function testParseScalarWithNonEscapedBlackslashShouldThrowException ()
129
121
{
122
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
123
+ $ this ->expectExceptionMessage ('Found unknown escape character "\V". ' );
130
124
Inline::parse ('"Foo\Var" ' );
131
125
}
132
126
133
- /**
134
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
135
- */
136
127
public function testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException ()
137
128
{
129
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
138
130
Inline::parse ('"Foo \\" ' );
139
131
}
140
132
141
- /**
142
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
143
- */
144
133
public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException ()
145
134
{
135
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
146
136
$ value = "'don't do somthin' like that' " ;
147
137
Inline::parse ($ value );
148
138
}
149
139
150
- /**
151
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
152
- */
153
140
public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException ()
154
141
{
142
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
155
143
$ value = '"don"t do somthin" like that" ' ;
156
144
Inline::parse ($ value );
157
145
}
158
146
159
- /**
160
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
161
- */
162
147
public function testParseInvalidMappingKeyShouldThrowException ()
163
148
{
149
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
164
150
$ value = '{ "foo " bar": "bar" } ' ;
165
151
Inline::parse ($ value );
166
152
}
167
153
168
- /**
169
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
170
- * @expectedExceptionMessage Colons must be followed by a space or an indication character (i.e. " ", ",", "[", "]", "{", "}")
171
- */
172
154
public function testParseMappingKeyWithColonNotFollowedBySpace ()
173
155
{
156
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
157
+ $ this ->expectExceptionMessage ('Colons must be followed by a space or an indication character (i.e. " ", ",", "[", "]", "{", "}") ' );
174
158
Inline::parse ('{foo:""} ' );
175
159
}
176
160
177
- /**
178
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
179
- */
180
161
public function testParseInvalidMappingShouldThrowException ()
181
162
{
163
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
182
164
Inline::parse ('[foo] bar ' );
183
165
}
184
166
185
- /**
186
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
187
- */
188
167
public function testParseInvalidSequenceShouldThrowException ()
189
168
{
169
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
190
170
Inline::parse ('{ foo: bar } bar ' );
191
171
}
192
172
@@ -230,21 +210,17 @@ public function testParseMapReferenceInSequence()
230
210
$ this ->assertSame ([$ foo ], Inline::parse ('[*foo] ' , 0 , ['foo ' => $ foo ]));
231
211
}
232
212
233
- /**
234
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
235
- * @expectedExceptionMessage A reference must contain at least one character at line 1.
236
- */
237
213
public function testParseUnquotedAsterisk ()
238
214
{
215
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
216
+ $ this ->expectExceptionMessage ('A reference must contain at least one character at line 1. ' );
239
217
Inline::parse ('{ foo: * } ' );
240
218
}
241
219
242
- /**
243
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
244
- * @expectedExceptionMessage A reference must contain at least one character at line 1.
245
- */
246
220
public function testParseUnquotedAsteriskFollowedByAComment ()
247
221
{
222
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
223
+ $ this ->expectExceptionMessage ('A reference must contain at least one character at line 1. ' );
248
224
Inline::parse ('{ foo: * #foo } ' );
249
225
}
250
226
@@ -615,10 +591,10 @@ public function getBinaryData()
615
591
616
592
/**
617
593
* @dataProvider getInvalidBinaryData
618
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
619
594
*/
620
595
public function testParseInvalidBinaryData ($ data , $ expectedMessage )
621
596
{
597
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
622
598
$ this ->expectExceptionMessageRegExp ($ expectedMessage );
623
599
624
600
Inline::parse ($ data );
@@ -634,12 +610,10 @@ public function getInvalidBinaryData()
634
610
];
635
611
}
636
612
637
- /**
638
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
639
- * @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported} at line 1.
640
- */
641
613
public function testNotSupportedMissingValue ()
642
614
{
615
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
616
+ $ this ->expectExceptionMessage ('Malformed inline YAML string: {this, is not, supported} at line 1. ' );
643
617
Inline::parse ('{this, is not, supported} ' );
644
618
}
645
619
@@ -653,12 +627,10 @@ public function testVeryLongQuotedStrings()
653
627
$ this ->assertEquals ($ longStringWithQuotes , $ arrayFromYaml ['longStringWithQuotes ' ]);
654
628
}
655
629
656
- /**
657
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
658
- * @expectedExceptionMessage Missing mapping key
659
- */
660
630
public function testMappingKeysCannotBeOmitted ()
661
631
{
632
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
633
+ $ this ->expectExceptionMessage ('Missing mapping key ' );
662
634
Inline::parse ('{: foo} ' );
663
635
}
664
636
@@ -684,13 +656,13 @@ public function testTheEmptyStringIsAValidMappingKey()
684
656
}
685
657
686
658
/**
687
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
688
- * @expectedExceptionMessage Implicit casting of incompatible mapping keys to strings is not supported. Quote your evaluable mapping keys instead
689
659
*
690
660
* @dataProvider getNotPhpCompatibleMappingKeyData
691
661
*/
692
662
public function testImplicitStringCastingOfMappingKeysIsDeprecated ($ yaml , $ expected )
693
663
{
664
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
665
+ $ this ->expectExceptionMessage ('Implicit casting of incompatible mapping keys to strings is not supported. Quote your evaluable mapping keys instead ' );
694
666
$ this ->assertSame ($ expected , Inline::parse ($ yaml ));
695
667
}
696
668
@@ -740,12 +712,10 @@ public function testTagWithEmptyValueInMapping()
740
712
$ this ->assertSame ('' , $ value ['foo ' ]->getValue ());
741
713
}
742
714
743
- /**
744
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
745
- * @expectedExceptionMessage Unexpected end of line, expected one of ",}" at line 1 (near "{abc: 'def'").
746
- */
747
715
public function testUnfinishedInlineMap ()
748
716
{
717
+ $ this ->expectException ('Symfony\Component\Yaml\Exception\ParseException ' );
718
+ $ this ->expectExceptionMessage ('Unexpected end of line, expected one of ",}" at line 1 (near "{abc: \'def \'"). ' );
749
719
Inline::parse ("{abc: 'def' " );
750
720
}
751
721
}
0 commit comments