Skip to content

Commit a11873c

Browse files
[PhpUnitBridge] Drop ErrorAssert in favor of @expectedDeprecation
1 parent f3abbc0 commit a11873c

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

Tests/InlineTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,13 @@ public function testParseInvalidMappingKeyShouldThrowException()
166166
}
167167

168168
/**
169-
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
169+
* @group legacy
170+
* @expectedDeprecation Omitting the space after the colon that follows a mapping key definition is deprecated since version 3.2 and will throw a ParseException in 4.0.
170171
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
171172
*/
172173
public function testParseMappingKeyWithColonNotFollowedBySpace()
173174
{
174-
ErrorAssert::assertDeprecationsAreTriggered('Omitting the space after the colon that follows a mapping key definition is deprecated since version 3.2 and will throw a ParseException in 4.0.', function () {
175-
Inline::parse('{1:""}');
176-
});
175+
Inline::parse('{1:""}');
177176
}
178177

179178
/**

Tests/ParserTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Yaml\Tests;
1313

14-
use Symfony\Bridge\PhpUnit\ErrorAssert;
1514
use Symfony\Component\Yaml\Yaml;
1615
use Symfony\Component\Yaml\Parser;
1716

@@ -809,15 +808,14 @@ public function testMappingDuplicateKeyFlow()
809808
}
810809

811810
/**
811+
* @group legacy
812812
* @dataProvider getParseExceptionOnDuplicateData
813-
* @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
813+
* @expectedDeprecation Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated %s.
814814
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
815815
*/
816816
public function testParseExceptionOnDuplicate($input, $duplicateKey, $lineNumber)
817817
{
818-
ErrorAssert::assertDeprecationsAreTriggered(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $duplicateKey, $lineNumber), function () use ($input) {
819-
Yaml::parse($input);
820-
});
818+
Yaml::parse($input);
821819
}
822820

823821
public function getParseExceptionOnDuplicateData()

0 commit comments

Comments
 (0)