Skip to content

Commit 7ec9333

Browse files
committed
Remove compat code for unsupported PHPUnit versions
1 parent 3c45941 commit 7ec9333

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

PhpUnit/ConfigurationValuesAreInvalidConstraint.php

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22

33
namespace Matthias\SymfonyConfigTest\PhpUnit;
44

5-
use PHPUnit\Framework\Constraint\ExceptionMessage;
6-
use PHPUnit\Framework\Constraint\ExceptionMessageIsOrContains;
75
use PHPUnit\Framework\Constraint\ExceptionMessageMatchesRegularExpression;
8-
use PHPUnit\Framework\Constraint\ExceptionMessageRegularExpression;
9-
use PHPUnit\Framework\Constraint\MessageIsOrContains;
10-
use PHPUnit\Framework\Constraint\MessageMatchesRegularExpression;
116
use Symfony\Component\Config\Definition\ConfigurationInterface;
127
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
138

@@ -64,38 +59,7 @@ private function evaluateException(\Exception $exception, $description, $returnR
6459
return true;
6560
}
6661

67-
return $this->createPhpUnitConstraint()
62+
return (new ExceptionMessageMatchesRegularExpression($this->expectedMessage))
6863
->evaluate($exception, $description, $returnResult);
6964
}
70-
71-
private function createPhpUnitConstraint()
72-
{
73-
if ($this->useRegExp) {
74-
// Available since PHPUnit 10.0.15
75-
if (class_exists(ExceptionMessageMatchesRegularExpression::class)) {
76-
return new ExceptionMessageMatchesRegularExpression($this->expectedMessage);
77-
}
78-
79-
// Available between PHPUnit 10.0.0 and 10.0.14 (inclusive)
80-
if (class_exists(MessageMatchesRegularExpression::class)) {
81-
return new MessageMatchesRegularExpression('exception', $this->expectedMessage);
82-
}
83-
84-
// Available in PHPUnit 9.6
85-
return new ExceptionMessageRegularExpression($this->expectedMessage);
86-
}
87-
88-
// Available since PHPUnit 10.0.15
89-
if (class_exists(ExceptionMessageIsOrContains::class)) {
90-
return new ExceptionMessageIsOrContains($this->expectedMessage);
91-
}
92-
93-
// Available between PHPUnit 10.0.0 and 10.0.14 (inclusive)
94-
if (class_exists(MessageIsOrContains::class)) {
95-
return new MessageIsOrContains('exception', $this->expectedMessage);
96-
}
97-
98-
// Available in PHPUnit 9.6
99-
return new ExceptionMessage($this->expectedMessage);
100-
}
10165
}

0 commit comments

Comments
 (0)