diff --git a/.gitattributes b/.gitattributes index 14c3c359..0a9dafc4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ /Tests export-ignore /phpunit.xml.dist export-ignore +/phpunit-9.6.xml.dist export-ignore /.git* export-ignore diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b139af3..579fd88a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +7.4 +--- + + * Add support for mocking the `strtotime()` function + 7.3 --- diff --git a/ClassExistsMock.php b/ClassExistsMock.php index 72ec51e0..61582425 100644 --- a/ClassExistsMock.php +++ b/ClassExistsMock.php @@ -62,7 +62,7 @@ public static function trait_exists($name, $autoload = true): bool return isset(self::$classes[$name]) ? (bool) self::$classes[$name] : \trait_exists($name, $autoload); } - public static function enum_exists($name, $autoload = true):bool + public static function enum_exists($name, $autoload = true): bool { $name = ltrim($name, '\\'); @@ -77,7 +77,7 @@ public static function register($class): void if (0 < strpos($class, '\\Tests\\')) { $ns = str_replace('\\Tests\\', '\\', $class); $mockedNs[] = substr($ns, 0, strrpos($ns, '\\')); - } elseif (0 === strpos($class, 'Tests\\')) { + } elseif (str_starts_with($class, 'Tests\\')) { $mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6); } foreach ($mockedNs as $ns) { diff --git a/ClockMock.php b/ClockMock.php index 4cca8fc2..9a9c910e 100644 --- a/ClockMock.php +++ b/ClockMock.php @@ -109,6 +109,18 @@ public static function hrtime($asNumber = false) return [(int) self::$now, (int) $ns]; } + /** + * @return false|int + */ + public static function strtotime(string $datetime, ?int $timestamp = null) + { + if (null === $timestamp) { + $timestamp = self::time(); + } + + return \strtotime($datetime, $timestamp); + } + public static function register($class): void { $self = static::class; @@ -117,7 +129,7 @@ public static function register($class): void if (0 < strpos($class, '\\Tests\\')) { $ns = str_replace('\\Tests\\', '\\', $class); $mockedNs[] = substr($ns, 0, strrpos($ns, '\\')); - } elseif (0 === strpos($class, 'Tests\\')) { + } elseif (str_starts_with($class, 'Tests\\')) { $mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6); } foreach ($mockedNs as $ns) { @@ -161,6 +173,11 @@ function hrtime(\$asNumber = false) { return \\$self::hrtime(\$asNumber); } + +function strtotime(\$datetime, \$timestamp = null) +{ + return \\$self::strtotime(\$datetime, \$timestamp); +} EOPHP ); } diff --git a/ConstraintTrait.php b/ConstraintTrait.php index ceb60418..9090cc4c 100644 --- a/ConstraintTrait.php +++ b/ConstraintTrait.php @@ -14,12 +14,7 @@ use PHPUnit\Framework\Constraint\Constraint; $r = new \ReflectionClass(Constraint::class); -if ($r->getProperty('exporter')->isProtected()) { - trait ConstraintTrait - { - use Legacy\ConstraintTraitForV7; - } -} elseif (!$r->getMethod('evaluate')->hasReturnType()) { +if (!$r->getMethod('evaluate')->hasReturnType()) { trait ConstraintTrait { use Legacy\ConstraintTraitForV8; diff --git a/CoverageListener.php b/CoverageListener.php index f1a89ff8..c3fa8ec5 100644 --- a/CoverageListener.php +++ b/CoverageListener.php @@ -29,7 +29,7 @@ class CoverageListener implements TestListener public function __construct(?callable $sutFqcnResolver = null, bool $warningOnSutNotFound = false) { $this->sutFqcnResolver = $sutFqcnResolver ?? static function (Test $test): ?string { - $class = \get_class($test); + $class = $test::class; $sutFqcn = str_replace('\\Tests\\', '\\', $class); $sutFqcn = preg_replace('{Test$}', '', $sutFqcn); @@ -46,7 +46,7 @@ public function startTest(Test $test): void return; } - $annotations = TestUtil::parseTestMethodAnnotations(\get_class($test), $test->getName(false)); + $annotations = TestUtil::parseTestMethodAnnotations($test::class, $test->getName(false)); $ignoredAnnotations = ['covers', 'coversDefaultClass', 'coversNothing']; @@ -86,13 +86,10 @@ public function startTest(Test $test): void private function addCoversForClassToAnnotationCache(Test $test, array $covers): void { $r = new \ReflectionProperty(TestUtil::class, 'annotationCache'); - if (\PHP_VERSION_ID < 80100) { - $r->setAccessible(true); - } $cache = $r->getValue(); $cache = array_replace_recursive($cache, [ - \get_class($test) => [ + $test::class => [ 'covers' => $covers, ], ]); @@ -102,12 +99,9 @@ private function addCoversForClassToAnnotationCache(Test $test, array $covers): private function addCoversForDocBlockInsideRegistry(Test $test, array $covers): void { - $docBlock = Registry::getInstance()->forClassName(\get_class($test)); + $docBlock = Registry::getInstance()->forClassName($test::class); $symbolAnnotations = new \ReflectionProperty($docBlock, 'symbolAnnotations'); - if (\PHP_VERSION_ID < 80100) { - $symbolAnnotations->setAccessible(true); - } // Exclude internal classes; PHPUnit 9.1+ is picky about tests covering, say, a \RuntimeException $covers = array_filter($covers, function (string $class) { diff --git a/DeprecationErrorHandler.php b/DeprecationErrorHandler.php index eb980b4b..b53d90e8 100644 --- a/DeprecationErrorHandler.php +++ b/DeprecationErrorHandler.php @@ -97,7 +97,7 @@ public static function collectDeprecations($outputFile) { $deprecations = []; $previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$deprecations, &$previousErrorHandler) { - if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) { + if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || !str_contains($msg, '" targeting switch is equivalent to "break'))) { if ($previousErrorHandler) { return $previousErrorHandler($type, $msg, $file, $line, $context); } @@ -129,7 +129,7 @@ public static function collectDeprecations($outputFile) */ public function handleError($type, $msg, $file, $line, $context = []) { - if ((\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) || !$this->getConfiguration()->isEnabled()) { + if ((\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || !str_contains($msg, '" targeting switch is equivalent to "break'))) || !$this->getConfiguration()->isEnabled()) { return \call_user_func(self::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context); } diff --git a/DeprecationErrorHandler/Deprecation.php b/DeprecationErrorHandler/Deprecation.php index 061dfff7..caf0b825 100644 --- a/DeprecationErrorHandler/Deprecation.php +++ b/DeprecationErrorHandler/Deprecation.php @@ -99,7 +99,7 @@ public function __construct(string $message, array $trace, string $file, bool $l $this->getOriginalFilesStack(); array_splice($this->originalFilesStack, 0, $j, [$this->triggeringFile]); - if (preg_match('/(?|"([^"]++)" that is deprecated|should implement method "(?:static )?([^:]++))/', $message, $m) || (false === strpos($message, '()" will return') && false === strpos($message, 'native return type declaration') && preg_match('/^(?:The|Method) "([^":]++)/', $message, $m))) { + if (preg_match('/(?|"([^"]++)" that is deprecated|should implement method "(?:static )?([^:]++))/', $message, $m) || (!str_contains($message, '()" will return') && !str_contains($message, 'native return type declaration') && preg_match('/^(?:The|Method) "([^":]++)/', $message, $m))) { $this->triggeringFile = (new \ReflectionClass($m[1]))->getFileName(); array_unshift($this->originalFilesStack, $this->triggeringFile); } @@ -137,7 +137,7 @@ public function __construct(string $message, array $trace, string $file, bool $l return; } - if (!isset($line['class'], $trace[$i - 2]['function']) || 0 !== strpos($line['class'], SymfonyTestsListenerFor::class)) { + if (!isset($line['class'], $trace[$i - 2]['function']) || !str_starts_with($line['class'], SymfonyTestsListenerFor::class)) { $this->originClass = isset($line['object']) ? \get_class($line['object']) : $line['class']; $this->originMethod = $line['function']; @@ -147,7 +147,7 @@ public function __construct(string $message, array $trace, string $file, bool $l $test = $line['args'][0] ?? null; if (($test instanceof TestCase || $test instanceof TestSuite) && ('trigger_error' !== $trace[$i - 2]['function'] || isset($trace[$i - 2]['class']))) { - $this->originClass = \get_class($test); + $this->originClass = $test::class; $this->originMethod = $test->getName(); } } @@ -159,7 +159,7 @@ private function lineShouldBeSkipped(array $line): bool } $class = $line['class']; - return 'ReflectionMethod' === $class || 0 === strpos($class, 'PHPUnit\\'); + return 'ReflectionMethod' === $class || str_starts_with($class, 'PHPUnit\\'); } public function originatesFromDebugClassLoader(): bool @@ -189,7 +189,7 @@ public function originatingClass(): string $class = $this->originClass; - return false !== strpos($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class; + return str_contains($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class; } public function originatingMethod(): string @@ -215,9 +215,9 @@ public function isLegacy(): bool $method = $this->originatingMethod(); $groups = class_exists(Groups::class, false) ? [new Groups(), 'groups'] : [Test::class, 'getGroups']; - return 0 === strpos($method, 'testLegacy') - || 0 === strpos($method, 'provideLegacy') - || 0 === strpos($method, 'getLegacy') + return str_starts_with($method, 'testLegacy') + || str_starts_with($method, 'provideLegacy') + || str_starts_with($method, 'getLegacy') || strpos($this->originClass, '\Legacy') || \in_array('legacy', $groups($this->originClass, $method), true); } @@ -228,10 +228,10 @@ public function isMuted(): bool return false; } if (isset($this->trace[1]['class'])) { - return 0 === strpos($this->trace[1]['class'], 'PHPUnit\\'); + return str_starts_with($this->trace[1]['class'], 'PHPUnit\\'); } - return false !== strpos($this->triggeringFile, \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR); + return str_contains($this->triggeringFile, \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR); } /** @@ -300,7 +300,7 @@ private function getPackage(string $path): string { $path = realpath($path) ?: $path; foreach (self::getVendors() as $vendorRoot) { - if (0 === strpos($path, $vendorRoot)) { + if (str_starts_with($path, $vendorRoot)) { $relativePath = substr($path, \strlen($vendorRoot) + 1); $vendor = strstr($relativePath, \DIRECTORY_SEPARATOR, true); if (false === $vendor) { @@ -326,7 +326,7 @@ private static function getVendors(): array self::$vendors[] = \dirname((new \ReflectionClass(DebugClassLoader::class))->getFileName()); } foreach (get_declared_classes() as $class) { - if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { + if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); $v = \dirname($r->getFileName(), 2); if (file_exists($v.'/composer/installed.json')) { @@ -341,7 +341,7 @@ private static function getVendors(): array } foreach ($paths as $path) { foreach (self::$vendors as $vendor) { - if (0 !== strpos($path, $vendor)) { + if (!str_starts_with($path, $vendor)) { self::$internalPaths[] = $path; } } @@ -371,13 +371,13 @@ private function getPathType(string $path): string return self::PATH_TYPE_UNDETERMINED; } foreach (self::getVendors() as $vendor) { - if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) { + if (str_starts_with($realPath, $vendor) && false !== strpbrk(substr($realPath, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) { return self::PATH_TYPE_VENDOR; } } foreach (self::$internalPaths as $internalPath) { - if (0 === strpos($realPath, $internalPath)) { + if (str_starts_with($realPath, $internalPath)) { return self::PATH_TYPE_SELF; } } @@ -389,9 +389,6 @@ public function toString(): string { $exception = new \Exception($this->message); $reflection = new \ReflectionProperty($exception, 'trace'); - if (\PHP_VERSION_ID < 80100) { - $reflection->setAccessible(true); - } $reflection->setValue($exception, $this->trace); return ($this->originatesFromAnObject() ? 'deprecation triggered by '.$this->originatingClass().'::'.$this->originatingMethod().":\n" : '') diff --git a/DnsMock.php b/DnsMock.php index 84251c10..bc2ac1a8 100644 --- a/DnsMock.php +++ b/DnsMock.php @@ -170,7 +170,7 @@ public static function register($class): void if (0 < strpos($class, '\\Tests\\')) { $ns = str_replace('\\Tests\\', '\\', $class); $mockedNs[] = substr($ns, 0, strrpos($ns, '\\')); - } elseif (0 === strpos($class, 'Tests\\')) { + } elseif (str_starts_with($class, 'Tests\\')) { $mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6); } foreach ($mockedNs as $ns) { diff --git a/Legacy/CommandForV7.php b/Legacy/CommandForV8.php similarity index 97% rename from Legacy/CommandForV7.php rename to Legacy/CommandForV8.php index 99a1e683..ffeb2b81 100644 --- a/Legacy/CommandForV7.php +++ b/Legacy/CommandForV8.php @@ -19,7 +19,7 @@ /** * @internal */ -class CommandForV7 extends BaseCommand +class CommandForV8 extends BaseCommand { protected function createRunner(): BaseRunner { diff --git a/Legacy/ConstraintTraitForV7.php b/Legacy/ConstraintTraitForV7.php deleted file mode 100644 index b132f473..00000000 --- a/Legacy/ConstraintTraitForV7.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\PhpUnit\Legacy; - -use SebastianBergmann\Exporter\Exporter; - -/** - * @internal - */ -trait ConstraintTraitForV7 -{ - use ConstraintLogicTrait; - - /** - * @return bool|null - */ - public function evaluate($other, $description = '', $returnResult = false) - { - return $this->doEvaluate($other, $description, $returnResult); - } - - public function count(): int - { - return $this->doCount(); - } - - public function toString(): string - { - return $this->doToString(); - } - - protected function additionalFailureDescription($other): string - { - return $this->doAdditionalFailureDescription($other); - } - - protected function exporter(): Exporter - { - if (null === $this->exporter) { - $this->exporter = new Exporter(); - } - - return $this->exporter; - } - - protected function failureDescription($other): string - { - return $this->doFailureDescription($other); - } - - protected function matches($other): bool - { - return $this->doMatches($other); - } -} diff --git a/Legacy/ExpectDeprecationTraitForV8_4.php b/Legacy/ExpectDeprecationTraitForV8_4.php index d1596352..95823c2c 100644 --- a/Legacy/ExpectDeprecationTraitForV8_4.php +++ b/Legacy/ExpectDeprecationTraitForV8_4.php @@ -22,7 +22,7 @@ trait ExpectDeprecationTraitForV8_4 public function expectDeprecation(): void { if (1 > \func_num_args() || !\is_string($message = func_get_arg(0))) { - throw new \InvalidArgumentException(sprintf('The "%s()" method requires the string $message argument.', __FUNCTION__)); + throw new \InvalidArgumentException(\sprintf('The "%s()" method requires the string $message argument.', __FUNCTION__)); } // Expected deprecations set by isolated tests need to be written to a file @@ -52,7 +52,7 @@ public function expectDeprecation(): void */ public function expectDeprecationMessage(string $message): void { - throw new \BadMethodCallException(sprintf('The "%s()" method is not supported by Symfony\'s PHPUnit Bridge ExpectDeprecationTrait, pass the message to expectDeprecation() instead.', __FUNCTION__)); + throw new \BadMethodCallException(\sprintf('The "%s()" method is not supported by Symfony\'s PHPUnit Bridge ExpectDeprecationTrait, pass the message to expectDeprecation() instead.', __FUNCTION__)); } /** @@ -60,6 +60,6 @@ public function expectDeprecationMessage(string $message): void */ public function expectDeprecationMessageMatches(string $regularExpression): void { - throw new \BadMethodCallException(sprintf('The "%s()" method is not supported by Symfony\'s PHPUnit Bridge ExpectDeprecationTrait.', __FUNCTION__)); + throw new \BadMethodCallException(\sprintf('The "%s()" method is not supported by Symfony\'s PHPUnit Bridge ExpectDeprecationTrait.', __FUNCTION__)); } } diff --git a/Legacy/PolyfillTestCaseTrait.php b/Legacy/PolyfillTestCaseTrait.php deleted file mode 100644 index 8673bdc0..00000000 --- a/Legacy/PolyfillTestCaseTrait.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\PhpUnit\Legacy; - -use PHPUnit\Framework\Error\Error; -use PHPUnit\Framework\Error\Notice; -use PHPUnit\Framework\Error\Warning; - -/** - * This trait is @internal. - */ -trait PolyfillTestCaseTrait -{ - /** - * @param string $messageRegExp - * - * @return void - */ - public function expectExceptionMessageMatches($messageRegExp) - { - $this->expectExceptionMessageRegExp($messageRegExp); - } - - /** - * @return void - */ - public function expectNotice() - { - $this->expectException(Notice::class); - } - - /** - * @param string $message - * - * @return void - */ - public function expectNoticeMessage($message) - { - $this->expectExceptionMessage($message); - } - - /** - * @param string $regularExpression - * - * @return void - */ - public function expectNoticeMessageMatches($regularExpression) - { - $this->expectExceptionMessageMatches($regularExpression); - } - - /** - * @return void - */ - public function expectWarning() - { - $this->expectException(Warning::class); - } - - /** - * @param string $message - * - * @return void - */ - public function expectWarningMessage($message) - { - $this->expectExceptionMessage($message); - } - - /** - * @param string $regularExpression - * - * @return void - */ - public function expectWarningMessageMatches($regularExpression) - { - $this->expectExceptionMessageMatches($regularExpression); - } - - /** - * @return void - */ - public function expectError() - { - $this->expectException(Error::class); - } - - /** - * @param string $message - * - * @return void - */ - public function expectErrorMessage($message) - { - $this->expectExceptionMessage($message); - } - - /** - * @param string $regularExpression - * - * @return void - */ - public function expectErrorMessageMatches($regularExpression) - { - $this->expectExceptionMessageMatches($regularExpression); - } -} diff --git a/Legacy/SymfonyTestsListenerTrait.php b/Legacy/SymfonyTestsListenerTrait.php index 413d46f0..2b7a3d1b 100644 --- a/Legacy/SymfonyTestsListenerTrait.php +++ b/Legacy/SymfonyTestsListenerTrait.php @@ -58,7 +58,7 @@ public function __construct(array $mockedNamespaces = []) (new ExcludeList())->getExcludedDirectories(); ExcludeList::addDirectory(\dirname((new \ReflectionClass(__CLASS__))->getFileName(), 2)); } elseif (method_exists(Blacklist::class, 'addDirectory')) { - (new BlackList())->getBlacklistedDirectories(); + (new Blacklist())->getBlacklistedDirectories(); Blacklist::addDirectory(\dirname((new \ReflectionClass(__CLASS__))->getFileName(), 2)); } else { Blacklist::$blacklistedClassNames[__CLASS__] = 2; @@ -125,7 +125,7 @@ public function startTestSuite($suite): void if (!$test instanceof TestCase) { continue; } - if (null === Test::getPreserveGlobalStateSettings(\get_class($test), $test->getName(false))) { + if (null === Test::getPreserveGlobalStateSettings($test::class, $test->getName(false))) { $test->setPreserveGlobalState(false); } } @@ -182,7 +182,7 @@ public function startTestSuite($suite): void continue; } if ($test instanceof TestCase - && isset($this->wasSkipped[\get_class($test)][$test->getName()]) + && isset($this->wasSkipped[$test::class][$test->getName()]) ) { $skipped[] = $test; } @@ -197,10 +197,10 @@ public function addSkippedTest($test, \Exception $e, $time): void if (0 < $this->state) { if ($test instanceof DataProviderTestSuite) { foreach ($test->tests() as $testWithDataProvider) { - $this->isSkipped[\get_class($testWithDataProvider)][$testWithDataProvider->getName()] = 1; + $this->isSkipped[$testWithDataProvider::class][$testWithDataProvider->getName()] = 1; } } else { - $this->isSkipped[\get_class($test)][$test->getName()] = 1; + $this->isSkipped[$test::class][$test->getName()] = 1; } } } @@ -221,15 +221,15 @@ public function startTest($test): void putenv('SYMFONY_EXPECTED_DEPRECATIONS_SERIALIZE='.tempnam(sys_get_temp_dir(), 'expectdeprec')); } - $groups = Test::getGroups(\get_class($test), $test->getName(false)); + $groups = Test::getGroups($test::class, $test->getName(false)); if (!$this->runsInSeparateProcess) { if (\in_array('time-sensitive', $groups, true)) { - ClockMock::register(\get_class($test)); + ClockMock::register($test::class); ClockMock::withClockMock(true); } if (\in_array('dns-sensitive', $groups, true)) { - DnsMock::register(\get_class($test)); + DnsMock::register($test::class); } } @@ -237,7 +237,7 @@ public function startTest($test): void return; } - $annotations = Test::parseTestMethodAnnotations(\get_class($test), $test->getName(false)); + $annotations = Test::parseTestMethodAnnotations($test::class, $test->getName(false)); if (isset($annotations['class']['expectedDeprecation'])) { $test->getTestResultObject()->addError($test, new AssertionFailedError('"@expectedDeprecation" annotations are not allowed at the class level.'), 0); @@ -275,14 +275,14 @@ public function endTest($test, $time): void DebugClassLoader::checkClasses(); } - $className = \get_class($test); + $className = $test::class; $groups = Test::getGroups($className, $test->getName(false)); if ($this->checkNumAssertions) { $assertions = \count(self::$expectedDeprecations) + $test->getNumAssertions(); if ($test instanceof TestCase && $test->doesNotPerformAssertions() && $assertions > 0) { - $test->getTestResultObject()->addFailure($test, new RiskyTestError(sprintf('This test is annotated with "@doesNotPerformAssertions", but performed %s assertions', $assertions)), $time); - } elseif ($test instanceof TestCase && $assertions === 0 && !$test->doesNotPerformAssertions() && $test->getTestResultObject()->noneSkipped()) { + $test->getTestResultObject()->addFailure($test, new RiskyTestError(\sprintf('This test is annotated with "@doesNotPerformAssertions", but performed %s assertions', $assertions)), $time); + } elseif ($test instanceof TestCase && 0 === $assertions && !$test->doesNotPerformAssertions() && $test->getTestResultObject()->noneSkipped()) { $test->getTestResultObject()->addFailure($test, new RiskyTestError('This test did not perform any assertions'), $time); } @@ -364,9 +364,6 @@ private function willBeIsolated(TestCase $test): bool } $r = new \ReflectionProperty($test, 'runTestInSeparateProcess'); - if (\PHP_VERSION_ID < 80100) { - $r->setAccessible(true); - } return $r->getValue($test) ?? false; } diff --git a/Tests/ClockMockTest.php b/Tests/ClockMockTest.php index 7df7865d..95c354e1 100644 --- a/Tests/ClockMockTest.php +++ b/Tests/ClockMockTest.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\PhpUnit\Tests; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ClockMock; @@ -19,6 +20,7 @@ * * @covers \Symfony\Bridge\PhpUnit\ClockMock */ +#[CoversClass(ClockMock::class)] class ClockMockTest extends TestCase { public static function setUpBeforeClass(): void @@ -79,4 +81,9 @@ public function testHrTimeAsNumber() { $this->assertSame(1234567890125000000, hrtime(true)); } + + public function testStrToTime() + { + $this->assertSame(1234567890, strtotime('now')); + } } diff --git a/Tests/CoverageListenerTest.php b/Tests/CoverageListenerTest.php index 99d4a4bc..9d6e26ed 100644 --- a/Tests/CoverageListenerTest.php +++ b/Tests/CoverageListenerTest.php @@ -11,11 +11,10 @@ namespace Symfony\Bridge\PhpUnit\Tests; +use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\TestCase; -/** - * @requires PHPUnit < 10 - */ +#[RequiresPhpunit('<10')] class CoverageListenerTest extends TestCase { public function test() @@ -34,7 +33,7 @@ public function test() exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text --colors=never 2> /dev/null", $output); $output = implode("\n", $output); - if (false === strpos($output, 'FooCov')) { + if (!str_contains($output, 'FooCov')) { $this->addToAssertionCount(1); } else { $this->assertMatchesRegularExpression('/FooCov\n\s*Methods:\s+0.00%[^\n]+Lines:\s+0.00%/', $output); diff --git a/Tests/DeprecationErrorHandler/ConfigurationTest.php b/Tests/DeprecationErrorHandler/ConfigurationTest.php index 0cb74fcf..3faadf33 100644 --- a/Tests/DeprecationErrorHandler/ConfigurationTest.php +++ b/Tests/DeprecationErrorHandler/ConfigurationTest.php @@ -11,15 +11,15 @@ namespace Symfony\Bridge\PhpUnit\Tests\DeprecationErrorHandler; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Configuration; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup; use Symfony\Component\ErrorHandler\DebugClassLoader; -/** - * @requires PHPUnit < 10 - */ +#[RequiresPhpunit('<10')] class ConfigurationTest extends TestCase { private $files; @@ -195,6 +195,7 @@ public static function provideItCanBeDisabled(): array /** * @dataProvider provideItCanBeDisabled */ + #[DataProvider('provideItCanBeDisabled')] public function testItCanBeDisabled(string $encodedString, bool $expectedEnabled) { $configuration = Configuration::fromUrlEncodedString($encodedString); @@ -241,6 +242,7 @@ public function testOutputIsNotVerboseInWeakMode() /** * @dataProvider provideDataForToleratesForGroup */ + #[DataProvider('provideDataForToleratesForGroup')] public function testToleratesForIndividualGroups(string $deprecationsHelper, array $deprecationsPerType, array $expected) { $configuration = Configuration::fromUrlEncodedString($deprecationsHelper); @@ -248,7 +250,7 @@ public function testToleratesForIndividualGroups(string $deprecationsHelper, arr $groups = $this->buildGroups($deprecationsPerType); foreach ($expected as $groupName => $tolerates) { - $this->assertSame($tolerates, $configuration->toleratesForGroup($groupName, $groups), sprintf('Deprecation type "%s" is %s', $groupName, $tolerates ? 'tolerated' : 'not tolerated')); + $this->assertSame($tolerates, $configuration->toleratesForGroup($groupName, $groups), \sprintf('Deprecation type "%s" is %s', $groupName, $tolerates ? 'tolerated' : 'not tolerated')); } } @@ -515,7 +517,7 @@ public function testBaselineFileException() $filename = $this->createFile(); unlink($filename); $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage(sprintf('The baselineFile "%s" does not exist.', $filename)); + $this->expectExceptionMessage(\sprintf('The baselineFile "%s" does not exist.', $filename)); Configuration::fromUrlEncodedString('baselineFile='.urlencode($filename)); } @@ -529,7 +531,7 @@ public function testBaselineFileWriteError() $this->expectExceptionMessageMatches('/[Ff]ailed to open stream: Permission denied/'); set_error_handler(static function (int $errno, string $errstr, ?string $errfile = null, ?int $errline = null): bool { - if ($errno & (E_WARNING | E_WARNING)) { + if ($errno & (\E_WARNING | \E_WARNING)) { throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); } @@ -595,7 +597,7 @@ public function testIgnoreFileException() $filename = $this->createFile(); unlink($filename); $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage(sprintf('The ignoreFile "%s" does not exist.', $filename)); + $this->expectExceptionMessage(\sprintf('The ignoreFile "%s" does not exist.', $filename)); Configuration::fromUrlEncodedString('ignoreFile='.urlencode($filename)); } diff --git a/Tests/DeprecationErrorHandler/DeprecationGroupTest.php b/Tests/DeprecationErrorHandler/DeprecationGroupTest.php index f6198f4c..38c9e27e 100644 --- a/Tests/DeprecationErrorHandler/DeprecationGroupTest.php +++ b/Tests/DeprecationErrorHandler/DeprecationGroupTest.php @@ -1,13 +1,21 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bridge\PhpUnit\Tests\DeprecationErrorHandler; +use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup; -/** - * @requires PHPUnit < 10 - */ +#[RequiresPhpunit('<10')] final class DeprecationGroupTest extends TestCase { public function testItGroupsByMessage() diff --git a/Tests/DeprecationErrorHandler/DeprecationNoticeTest.php b/Tests/DeprecationErrorHandler/DeprecationNoticeTest.php index c6e2cce7..6e093613 100644 --- a/Tests/DeprecationErrorHandler/DeprecationNoticeTest.php +++ b/Tests/DeprecationErrorHandler/DeprecationNoticeTest.php @@ -1,13 +1,21 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bridge\PhpUnit\Tests\DeprecationErrorHandler; +use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationNotice; -/** - * @requires PHPUnit < 10 - */ +#[RequiresPhpunit('<10')] final class DeprecationNoticeTest extends TestCase { public function testItGroupsByCaller() diff --git a/Tests/DeprecationErrorHandler/DeprecationTest.php b/Tests/DeprecationErrorHandler/DeprecationTest.php index eb8d44ac..bad55d1e 100644 --- a/Tests/DeprecationErrorHandler/DeprecationTest.php +++ b/Tests/DeprecationErrorHandler/DeprecationTest.php @@ -11,14 +11,14 @@ namespace Symfony\Bridge\PhpUnit\Tests\DeprecationErrorHandler; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation; use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV7; -/** - * @requires PHPUnit < 10 - */ +#[RequiresPhpunit('<10')] class DeprecationTest extends TestCase { private static $vendorDir; @@ -31,7 +31,7 @@ private static function getVendorDir() } foreach (get_declared_classes() as $class) { - if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { + if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); $vendorDir = \dirname($r->getFileName(), 2); if (file_exists($vendorDir.'/composer/installed.json') && @mkdir($vendorDir.'/myfakevendor/myfakepackage1', 0777, true)) { @@ -91,6 +91,7 @@ public function testItRulesOutFilesOutsideVendorsAsIndirect() /** * @dataProvider mutedProvider */ + #[DataProvider('mutedProvider')] public function testItMutesOnlySpecificErrorMessagesWhenTheCallingCodeIsInPhpunit($muted, $callingClass, $message) { $trace = $this->debugBacktrace(); @@ -173,6 +174,7 @@ public static function providerGetTypeDetectsSelf(): array /** * @dataProvider providerGetTypeDetectsSelf */ + #[DataProvider('providerGetTypeDetectsSelf')] public function testGetTypeDetectsSelf(string $expectedType, string $message, string $traceClass, string $file) { $trace = [ @@ -236,6 +238,7 @@ public static function providerGetTypeUsesRightTrace(): array /** * @dataProvider providerGetTypeUsesRightTrace */ + #[DataProvider('providerGetTypeUsesRightTrace')] public function testGetTypeUsesRightTrace(string $expectedType, string $message, array $trace) { $deprecation = new Deprecation( @@ -271,16 +274,13 @@ private static function removeDir($dir) public static function setUpBeforeClass(): void { foreach (get_declared_classes() as $class) { - if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { + if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); $v = \dirname($r->getFileName(), 2); if (file_exists($v.'/composer/installed.json')) { $loader = require $v.'/autoload.php'; $reflection = new \ReflectionClass($loader); $prop = $reflection->getProperty('prefixDirsPsr4'); - if (\PHP_VERSION_ID < 80100) { - $prop->setAccessible(true); - } $currentValue = $prop->getValue($loader); self::$prefixDirsPsr4[] = [$prop, $loader, $currentValue]; $currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')]; diff --git a/Tests/DeprecationErrorHandler/deprecation/deprecation.php b/Tests/DeprecationErrorHandler/deprecation/deprecation.php index 92efd950..0ea3e5c3 100644 --- a/Tests/DeprecationErrorHandler/deprecation/deprecation.php +++ b/Tests/DeprecationErrorHandler/deprecation/deprecation.php @@ -1,3 +1,12 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + @trigger_error('I come from… afar! :D', \E_USER_DEPRECATED); diff --git a/Tests/DeprecationErrorHandler/fake_app/AppService.php b/Tests/DeprecationErrorHandler/fake_app/AppService.php index 2b6cb316..b8f6dc25 100644 --- a/Tests/DeprecationErrorHandler/fake_app/AppService.php +++ b/Tests/DeprecationErrorHandler/fake_app/AppService.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace App\Services; use acme\lib\SomeService; @@ -20,9 +29,9 @@ public function selfDeprecation(bool $useContracts = false) { $args = [__FUNCTION__, __FUNCTION__]; if ($useContracts) { - trigger_deprecation('App', '3.0', sprintf('%s is deprecated, use %s_new instead.', ...$args)); + trigger_deprecation('App', '3.0', \sprintf('%s is deprecated, use %s_new instead.', ...$args)); } else { - @trigger_error(sprintf('Since App 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED); + @trigger_error(\sprintf('Since App 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED); } } diff --git a/Tests/DeprecationErrorHandler/fake_app/BarService.php b/Tests/DeprecationErrorHandler/fake_app/BarService.php index 868de5bd..5e0d66c0 100644 --- a/Tests/DeprecationErrorHandler/fake_app/BarService.php +++ b/Tests/DeprecationErrorHandler/fake_app/BarService.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace App\Services; use acme\lib\ExtendsDeprecatedClassFromOtherVendor; diff --git a/Tests/DeprecationErrorHandler/fake_app/ExtendsDeprecatedFromVendor.php b/Tests/DeprecationErrorHandler/fake_app/ExtendsDeprecatedFromVendor.php index b4305e0d..2105c3ca 100644 --- a/Tests/DeprecationErrorHandler/fake_app/ExtendsDeprecatedFromVendor.php +++ b/Tests/DeprecationErrorHandler/fake_app/ExtendsDeprecatedFromVendor.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace App\Services; use fcy\lib\DeprecatedClass; diff --git a/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/ExtendsDeprecatedClassFromOtherVendor.php b/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/ExtendsDeprecatedClassFromOtherVendor.php index f748109d..600faca8 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/ExtendsDeprecatedClassFromOtherVendor.php +++ b/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/ExtendsDeprecatedClassFromOtherVendor.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace acme\lib; use fcy\lib\DeprecatedClass; diff --git a/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/PhpDeprecation.php b/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/PhpDeprecation.php index 26a3237e..e38211b1 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/PhpDeprecation.php +++ b/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/PhpDeprecation.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace acme\lib; class PhpDeprecation implements \Serializable diff --git a/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/SomeService.php b/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/SomeService.php index cc237e61..6064426f 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/SomeService.php +++ b/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/SomeService.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace acme\lib; use bar\lib\AnotherService; @@ -10,9 +19,9 @@ public function deprecatedApi(bool $useContracts = false) { $args = [__FUNCTION__, __FUNCTION__]; if ($useContracts) { - trigger_deprecation('acme/lib', '3.0', sprintf('%s is deprecated, use %s_new instead.', ...$args)); + trigger_deprecation('acme/lib', '3.0', \sprintf('%s is deprecated, use %s_new instead.', ...$args)); } else { - @trigger_error(sprintf('Since acme/lib 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED); + @trigger_error(\sprintf('Since acme/lib 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED); } } diff --git a/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php b/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php index c6507d7f..5784566c 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php +++ b/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + eval(<<<'EOPHP' namespace PHPUnit\Util; diff --git a/Tests/DeprecationErrorHandler/fake_vendor/autoload.php b/Tests/DeprecationErrorHandler/fake_vendor/autoload.php index 3c4471bc..68db330c 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor/autoload.php +++ b/Tests/DeprecationErrorHandler/fake_vendor/autoload.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + require_once __DIR__.'/composer/autoload_real.php'; return ComposerAutoloaderInitFake::getLoader(); diff --git a/Tests/DeprecationErrorHandler/fake_vendor/bar/lib/AnotherService.php b/Tests/DeprecationErrorHandler/fake_vendor/bar/lib/AnotherService.php index 2e2f0f9b..27241866 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor/bar/lib/AnotherService.php +++ b/Tests/DeprecationErrorHandler/fake_vendor/bar/lib/AnotherService.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace bar\lib; class AnotherService @@ -8,9 +17,9 @@ public function deprecatedApi(bool $useContracts = false) { $args = [__FUNCTION__, __FUNCTION__]; if ($useContracts) { - trigger_deprecation('bar/lib', '3.0', sprintf('%s is deprecated, use %s_new instead.', ...$args)); + trigger_deprecation('bar/lib', '3.0', \sprintf('%s is deprecated, use %s_new instead.', ...$args)); } else { - @trigger_error(sprintf('Since bar/lib 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED); + @trigger_error(\sprintf('Since bar/lib 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED); } } } diff --git a/Tests/DeprecationErrorHandler/fake_vendor/composer/autoload_real.php b/Tests/DeprecationErrorHandler/fake_vendor/composer/autoload_real.php index 4b80d96c..231ae4f5 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor/composer/autoload_real.php +++ b/Tests/DeprecationErrorHandler/fake_vendor/composer/autoload_real.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + class ComposerLoaderFake { public function getPrefixes() @@ -27,7 +36,7 @@ public function loadClass($className) public function findFile($class) { foreach ($this->getPrefixesPsr4() as $prefix => $baseDirs) { - if (0 !== strpos($class, $prefix)) { + if (!str_starts_with($class, $prefix)) { continue; } diff --git a/Tests/DeprecationErrorHandler/fake_vendor/fcy/lib/DeprecatedClass.php b/Tests/DeprecationErrorHandler/fake_vendor/fcy/lib/DeprecatedClass.php index f6672cea..16edcaf6 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor/fcy/lib/DeprecatedClass.php +++ b/Tests/DeprecationErrorHandler/fake_vendor/fcy/lib/DeprecatedClass.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace fcy\lib; /** diff --git a/Tests/DeprecationErrorHandler/fake_vendor_bis/autoload.php b/Tests/DeprecationErrorHandler/fake_vendor_bis/autoload.php index c1c96392..f1aec32c 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor_bis/autoload.php +++ b/Tests/DeprecationErrorHandler/fake_vendor_bis/autoload.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + require_once __DIR__.'/composer/autoload_real.php'; return ComposerAutoloaderInitFakeBis::getLoader(); diff --git a/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/autoload_real.php b/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/autoload_real.php index aabb103e..2a52065d 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/autoload_real.php +++ b/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/autoload_real.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + class ComposerLoaderFakeBis { public function getPrefixes() @@ -17,7 +26,7 @@ public function getPrefixesPsr4() public function loadClass($className) { foreach ($this->getPrefixesPsr4() as $prefix => $baseDirs) { - if (0 !== strpos($className, $prefix)) { + if (!str_starts_with($className, $prefix)) { continue; } diff --git a/Tests/DeprecationErrorHandler/fake_vendor_bis/foo/lib/SomeOtherService.php b/Tests/DeprecationErrorHandler/fake_vendor_bis/foo/lib/SomeOtherService.php index 8ab32307..d9c67b1c 100644 --- a/Tests/DeprecationErrorHandler/fake_vendor_bis/foo/lib/SomeOtherService.php +++ b/Tests/DeprecationErrorHandler/fake_vendor_bis/foo/lib/SomeOtherService.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace foo\lib; class SomeOtherService diff --git a/Tests/DeprecationErrorHandler/generate_phar.php b/Tests/DeprecationErrorHandler/generate_phar.php index 75125d51..df875111 100644 --- a/Tests/DeprecationErrorHandler/generate_phar.php +++ b/Tests/DeprecationErrorHandler/generate_phar.php @@ -1,4 +1,13 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + $phar = new Phar(__DIR__.\DIRECTORY_SEPARATOR.'deprecation.phar', 0, 'deprecation.phar'); $phar->buildFromDirectory(__DIR__.\DIRECTORY_SEPARATOR.'deprecation'); diff --git a/Tests/DeprecationErrorHandler/php_deprecation_from_vendor_class.phpt b/Tests/DeprecationErrorHandler/php_deprecation_from_vendor_class.phpt index 38bf7ce8..bfa38585 100644 --- a/Tests/DeprecationErrorHandler/php_deprecation_from_vendor_class.phpt +++ b/Tests/DeprecationErrorHandler/php_deprecation_from_vendor_class.phpt @@ -1,7 +1,5 @@ --TEST-- Test that a PHP deprecation from a vendor class autoload is considered indirect. ---SKIPIF-- - --FILE-- expectDeprecation('foo'); @@ -39,6 +41,8 @@ public function testOne() * * @runInSeparateProcess */ + #[Group('legacy')] + #[RunInSeparateProcess] public function testOneInIsolation() { $this->expectDeprecation('foo'); @@ -50,6 +54,7 @@ public function testOneInIsolation() * * @group legacy */ + #[Group('legacy')] public function testMany() { $this->expectDeprecation('foo'); @@ -65,6 +70,7 @@ public function testMany() * * @expectedDeprecation foo */ + #[Group('legacy')] public function testOneWithAnnotation() { $this->expectDeprecation('bar'); @@ -80,6 +86,7 @@ public function testOneWithAnnotation() * @expectedDeprecation foo * @expectedDeprecation bar */ + #[Group('legacy')] public function testManyWithAnnotation() { $this->expectDeprecation('ccc'); diff --git a/Tests/ExpectedDeprecationAnnotationTest.php b/Tests/ExpectedDeprecationAnnotationTest.php index 1db5448c..a3112cf7 100644 --- a/Tests/ExpectedDeprecationAnnotationTest.php +++ b/Tests/ExpectedDeprecationAnnotationTest.php @@ -11,11 +11,11 @@ namespace Symfony\Bridge\PhpUnit\Tests; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\TestCase; -/** - * @requires PHPUnit < 10 - */ +#[RequiresPhpunit('<10')] final class ExpectedDeprecationAnnotationTest extends TestCase { /** @@ -25,6 +25,7 @@ final class ExpectedDeprecationAnnotationTest extends TestCase * * @expectedDeprecation foo */ + #[Group('legacy')] public function testOne() { @trigger_error('foo', \E_USER_DEPRECATED); @@ -38,6 +39,7 @@ public function testOne() * @expectedDeprecation foo * @expectedDeprecation bar */ + #[Group('legacy')] public function testMany() { @trigger_error('foo', \E_USER_DEPRECATED); diff --git a/Tests/FailTests/ExpectDeprecationTraitTestFail.php b/Tests/FailTests/ExpectDeprecationTraitTestFail.php index 7bf40df6..10da25f4 100644 --- a/Tests/FailTests/ExpectDeprecationTraitTestFail.php +++ b/Tests/FailTests/ExpectDeprecationTraitTestFail.php @@ -11,6 +11,9 @@ namespace Symfony\Bridge\PhpUnit\Tests\FailTests; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpunit; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; @@ -19,9 +22,8 @@ * * This class is deliberately suffixed with *TestFail.php so that it is ignored * by PHPUnit. This test is designed to fail. See ../expectdeprecationfail.phpt. - * - * @requires PHPUnit < 10 */ +#[RequiresPhpunit('<10')] final class ExpectDeprecationTraitTestFail extends TestCase { use ExpectDeprecationTrait; @@ -31,6 +33,7 @@ final class ExpectDeprecationTraitTestFail extends TestCase * * @group legacy */ + #[Group('legacy')] public function testOne() { $this->expectDeprecation('foo'); @@ -44,6 +47,8 @@ public function testOne() * * @runInSeparateProcess */ + #[Group('legacy')] + #[RunInSeparateProcess] public function testOneInIsolation() { $this->expectDeprecation('foo'); diff --git a/Tests/FailTests/NoAssertionsTestNotRisky.php b/Tests/FailTests/NoAssertionsTestNotRisky.php index 80082876..bd259a50 100644 --- a/Tests/FailTests/NoAssertionsTestNotRisky.php +++ b/Tests/FailTests/NoAssertionsTestNotRisky.php @@ -11,15 +11,15 @@ namespace Symfony\Bridge\PhpUnit\Tests\FailTests; +use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; /** * This class is deliberately suffixed with *TestRisky.php so that it is ignored * by PHPUnit. This test is designed to fail. See ../expectnotrisky.phpt. - * - * @requires PHPUnit < 10 */ +#[RequiresPhpunit('<10')] final class NoAssertionsTestNotRisky extends TestCase { use ExpectDeprecationTrait; diff --git a/Tests/FailTests/NoAssertionsTestRisky.php b/Tests/FailTests/NoAssertionsTestRisky.php index 5ec13753..559b86b8 100644 --- a/Tests/FailTests/NoAssertionsTestRisky.php +++ b/Tests/FailTests/NoAssertionsTestRisky.php @@ -11,15 +11,16 @@ namespace Symfony\Bridge\PhpUnit\Tests\FailTests; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; /** * This class is deliberately suffixed with *TestRisky.php so that it is ignored * by PHPUnit. This test is designed to fail. See ../expectrisky.phpt. - * - * @requires PHPUnit < 10 */ +#[RequiresPhpunit('<10')] final class NoAssertionsTestRisky extends TestCase { use ExpectDeprecationTrait; @@ -29,6 +30,7 @@ final class NoAssertionsTestRisky extends TestCase * * @group legacy */ + #[Group('legacy')] public function testOne() { $this->expectNotToPerformAssertions(); diff --git a/Tests/Fixtures/coverage/tests/CoversDefaultClassTest.php b/Tests/Fixtures/coverage/tests/CoversDefaultClassTest.php index d764638d..503d675b 100644 --- a/Tests/Fixtures/coverage/tests/CoversDefaultClassTest.php +++ b/Tests/Fixtures/coverage/tests/CoversDefaultClassTest.php @@ -9,11 +9,13 @@ * file that was distributed with this source code. */ +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \DateTime */ +#[CoversClass(DateTime::class)] class CoversDefaultClassTest extends TestCase { public function test() diff --git a/Tests/Fixtures/coverage/tests/CoversNothingTest.php b/Tests/Fixtures/coverage/tests/CoversNothingTest.php index e60ea97e..8e3cb0a7 100644 --- a/Tests/Fixtures/coverage/tests/CoversNothingTest.php +++ b/Tests/Fixtures/coverage/tests/CoversNothingTest.php @@ -9,11 +9,13 @@ * file that was distributed with this source code. */ +use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\TestCase; /** * @coversNothing */ +#[CoversNothing] class CoversNothingTest extends TestCase { public function test() diff --git a/Tests/Fixtures/coverage/tests/CoversTest.php b/Tests/Fixtures/coverage/tests/CoversTest.php index f6d34060..67ac74d7 100644 --- a/Tests/Fixtures/coverage/tests/CoversTest.php +++ b/Tests/Fixtures/coverage/tests/CoversTest.php @@ -9,13 +9,15 @@ * file that was distributed with this source code. */ +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; +/** + * @covers \DateTime + */ +#[CoversClass(DateTime::class)] class CoversTest extends TestCase { - /** - * @covers \DateTime - */ public function test() { $this->assertTrue(true); diff --git a/Tests/Metadata/AttributeReaderTest.php b/Tests/Metadata/AttributeReaderTest.php index b82a7acc..eb3a7765 100644 --- a/Tests/Metadata/AttributeReaderTest.php +++ b/Tests/Metadata/AttributeReaderTest.php @@ -11,20 +11,19 @@ namespace Symfony\Bridge\PhpUnit\Tests\Metadata; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\Attribute\DnsSensitive; use Symfony\Bridge\PhpUnit\Attribute\TimeSensitive; use Symfony\Bridge\PhpUnit\Metadata\AttributeReader; use Symfony\Bridge\PhpUnit\Tests\Metadata\Fixtures\FooBar; -/** - * @requires PHP 8.0 - */ -final class AttributeReaderTest extends TestCase +class AttributeReaderTest extends TestCase { /** * @dataProvider provideReadCases */ + #[DataProvider('provideReadCases')] public function testAttributesAreRead(string $method, string $attributeClass, array $expected) { $reader = new AttributeReader(); diff --git a/Tests/OnlyExpectingDeprecationSkippedTest.php b/Tests/OnlyExpectingDeprecationSkippedTest.php index 593e0b4e..aede756a 100644 --- a/Tests/OnlyExpectingDeprecationSkippedTest.php +++ b/Tests/OnlyExpectingDeprecationSkippedTest.php @@ -11,6 +11,8 @@ namespace Symfony\Bridge\PhpUnit\Tests; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\TestCase; /** @@ -18,6 +20,7 @@ * * @requires extension ext-dummy */ +#[RequiresPhpExtension('ext-dummy')] final class OnlyExpectingDeprecationSkippedTest extends TestCase { /** @@ -27,6 +30,7 @@ final class OnlyExpectingDeprecationSkippedTest extends TestCase * * @expectedDeprecation unreachable */ + #[Group('legacy')] public function testExpectingOnlyDeprecations() { $this->fail('should never be ran.'); diff --git a/Tests/ProcessIsolationTest.php b/Tests/ProcessIsolationTest.php index 07fb9a22..d86e2db6 100644 --- a/Tests/ProcessIsolationTest.php +++ b/Tests/ProcessIsolationTest.php @@ -11,6 +11,9 @@ namespace Symfony\Bridge\PhpUnit\Tests; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpunit; +use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; /** @@ -19,9 +22,9 @@ * @group legacy * * @runTestsInSeparateProcesses - * - * @requires PHPUnit < 10 */ +#[RequiresPhpunit('<10')] +#[Group('legacy')] class ProcessIsolationTest extends TestCase { /** @@ -35,7 +38,7 @@ public function testIsolation() public function testCallingOtherErrorHandler() { - $this->expectException(\PHPUnit\Framework\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('Test that PHPUnit\'s error handler fires.'); trigger_error('Test that PHPUnit\'s error handler fires.', \E_USER_WARNING); diff --git a/Tests/symfonyextensionnotregistered.phpt b/Tests/symfonyextensionnotregistered.phpt index e66b677f..0a140770 100644 --- a/Tests/symfonyextensionnotregistered.phpt +++ b/Tests/symfonyextensionnotregistered.phpt @@ -23,451 +23,451 @@ Expected deprecation with message "The "Symfony\Bridge\PhpUnit\Tests\Fixtures\sy %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testTimeMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testMicrotimeMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testSleepMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testUsleepMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDateMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGmdateMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testHrtimeMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testCheckdnsrrMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsCheckRecordMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGetmxrrMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetMxMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbyaddrMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynameMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testGethostbynamelMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered with data set "test class namespace" ('Symfony\Bridge\PhpUnit\Tests') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered%stest class namespace%s ('Symfony\Bridge\PhpUnit\Tests') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered with data set "namespace derived from test namespace" ('Symfony\Bridge\PhpUnit') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered%snamespace derived from test namespace%s ('Symfony\Bridge\PhpUnit') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered with data set "explicitly configured namespace" ('App') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered%sexplicitly configured namespace%s ('App') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered with data set "explicitly configured namespace through attribute on class" ('App\Foo') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered%sexplicitly configured namespace through attribute on class%s ('App\Foo') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d %s/.phpunit/phpunit-%s/phpunit:%d -%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered with data set "explicitly configured namespace through attribute on method" ('App\Bar') +%d) Symfony\Bridge\PhpUnit\Tests\SymfonyExtension::testDnsGetRecordMockIsRegistered%sexplicitly configured namespace through attribute on method%s ('App\Bar') Failed asserting that false is true. %s/src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php:%d diff --git a/TextUI/Command.php b/TextUI/Command.php index 3cc158f6..9cf7b8f2 100644 --- a/TextUI/Command.php +++ b/TextUI/Command.php @@ -12,7 +12,7 @@ namespace Symfony\Bridge\PhpUnit\TextUI; if (version_compare(\PHPUnit\Runner\Version::id(), '9.0.0', '<')) { - class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV7', 'Symfony\Bridge\PhpUnit\TextUI\Command'); + class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV8', 'Symfony\Bridge\PhpUnit\TextUI\Command'); } else { class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV9', 'Symfony\Bridge\PhpUnit\TextUI\Command'); } diff --git a/bin/simple-phpunit.php b/bin/simple-phpunit.php index d33fac04..f6262866 100644 --- a/bin/simple-phpunit.php +++ b/bin/simple-phpunit.php @@ -57,7 +57,7 @@ break; } // short option - if (0 === strpos($cliArgument, '-c')) { + if (str_starts_with($cliArgument, '-c')) { if ('-c' === $cliArgument && array_key_exists($cliArgumentIndex + 1, $argv)) { $phpunitConfigFilename = $getPhpUnitConfig($argv[$cliArgumentIndex + 1]); } else { @@ -97,11 +97,7 @@ } }; -if (\PHP_VERSION_ID >= 80000) { - $PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '9.6') ?: '9.6'; -} else { - $PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '8.5') ?: '8.5'; -} +$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '9.6') ?: '9.6'; $MAX_PHPUNIT_VERSION = $getEnvVar('SYMFONY_MAX_PHPUNIT_VERSION', false); @@ -169,7 +165,7 @@ $prevCacheDir = getenv('COMPOSER_CACHE_DIR'); if ($prevCacheDir) { if (false === $absoluteCacheDir = realpath($prevCacheDir)) { - @mkdir($prevCacheDir, 0777, true); + @mkdir($prevCacheDir, 0o777, true); $absoluteCacheDir = realpath($prevCacheDir); } if ($absoluteCacheDir) { @@ -178,14 +174,14 @@ $prevCacheDir = false; } } -$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml' : '')); +$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'); $SYMFONY_PHPUNIT_REQUIRE = $getEnvVar('SYMFONY_PHPUNIT_REQUIRE', ''); $configurationHash = md5(implode(\PHP_EOL, [md5_file(__FILE__), $SYMFONY_PHPUNIT_REMOVE, $SYMFONY_PHPUNIT_REQUIRE, (int) $PHPUNIT_REMOVE_RETURN_TYPEHINT])); $PHPUNIT_VERSION_DIR = sprintf('phpunit-%s-%d', $PHPUNIT_VERSION, $PHPUNIT_REMOVE_RETURN_TYPEHINT); if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationHash !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION_DIR.md5")) { // Build a standalone phpunit without symfony/yaml nor prophecy by default - @mkdir($PHPUNIT_DIR, 0777, true); + @mkdir($PHPUNIT_DIR, 0o777, true); chdir($PHPUNIT_DIR); if (file_exists("$PHPUNIT_VERSION_DIR")) { passthru(sprintf('\\' === \DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s 2> NUL' : 'rm -rf %s', escapeshellarg("$PHPUNIT_VERSION_DIR.old"))); @@ -240,9 +236,6 @@ if ($SYMFONY_PHPUNIT_REQUIRE) { $passthruOrFail("$COMPOSER require --no-update ".$SYMFONY_PHPUNIT_REQUIRE); } - if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) { - $passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\""); - } if (preg_match('{\^((\d++\.)\d++)[\d\.]*$}', $info['requires']['php'], $phpVersion) && version_compare($phpVersion[2].'99', \PHP_VERSION, '<')) { $passthruOrFail("$COMPOSER config platform.php \"$phpVersion[1].99\""); @@ -267,9 +260,8 @@ } $prevRoot = getenv('COMPOSER_ROOT_VERSION'); putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); - $q = '\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 80000 ? '"' : ''; // --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS - $exit = proc_close(proc_open("$q$COMPOSER update --no-dev --prefer-dist --no-progress $q", [], $p, getcwd())); + $exit = proc_close(proc_open("$COMPOSER update --no-dev --prefer-dist --no-progress", [], $p, getcwd())); putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : '')); if ($prevCacheDir) { putenv("COMPOSER_CACHE_DIR=$prevCacheDir"); @@ -284,8 +276,6 @@ if ($PHPUNIT_REMOVE_RETURN_TYPEHINT) { $alteredCode = preg_replace('/^ ((?:protected|public)(?: static)? function \w+\(\)): void/m', ' $1', $alteredCode); } - $alteredCode = preg_replace('/abstract class TestCase[^\{]+\{/', '$0 '.\PHP_EOL." use \Symfony\Bridge\PhpUnit\Legacy\PolyfillTestCaseTrait;", $alteredCode, 1); - file_put_contents($alteredFile, $alteredCode); // Mutate Assert code $alteredCode = file_get_contents($alteredFile = './src/Framework/Assert.php'); @@ -293,30 +283,30 @@ file_put_contents($alteredFile, $alteredCode); file_put_contents('phpunit', <<<'EOPHP' -getExcludedDirectories(); - PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListPhpunit::class))->getFileName())); - class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListSimplePhpunit::class))->getFileName())); -} elseif (method_exists(\PHPUnit\Util\Blacklist::class, 'addDirectory')) { - (new PHPUnit\Util\BlackList())->getBlacklistedDirectories(); - PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListPhpunit::class))->getFileName())); - class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListSimplePhpunit::class))->getFileName())); -} else { - PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListPhpunit'] = 1; - PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListSimplePhpunit'] = 1; -} + if (!class_exists(\SymfonyExcludeListPhpunit::class, false)) { + class SymfonyExcludeListPhpunit {} + } + if (method_exists(\PHPUnit\Util\ExcludeList::class, 'addDirectory')) { + (new PHPUnit\Util\Excludelist())->getExcludedDirectories(); + PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListPhpunit::class))->getFileName())); + class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListSimplePhpunit::class))->getFileName())); + } elseif (method_exists(\PHPUnit\Util\Blacklist::class, 'addDirectory')) { + (new PHPUnit\Util\BlackList())->getBlacklistedDirectories(); + PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListPhpunit::class))->getFileName())); + class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListSimplePhpunit::class))->getFileName())); + } else { + PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListPhpunit'] = 1; + PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListSimplePhpunit'] = 1; + } -Symfony\Bridge\PhpUnit\TextUI\Command::main(); + Symfony\Bridge\PhpUnit\TextUI\Command::main(); -EOPHP + EOPHP ); } @@ -340,16 +330,7 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla } chdir($oldPwd); -if ($PHPUNIT_VERSION < 8.0) { - $argv = array_filter($argv, function ($v) use (&$argc) { - if ('--do-not-cache-result' !== $v) { - return true; - } - --$argc; - - return false; - }); -} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), \FILTER_VALIDATE_BOOLEAN)) { +if (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), \FILTER_VALIDATE_BOOLEAN)) { $argv[] = '--do-not-cache-result'; ++$argc; } diff --git a/bootstrap.php b/bootstrap.php index 24d59340..55409047 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ -use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Deprecations\Deprecation; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler; @@ -35,19 +34,6 @@ if (class_exists(Deprecation::class)) { Deprecation::withoutDeduplication(); - - if (\PHP_VERSION_ID < 80000) { - // Ignore deprecations about the annotation mapping driver when it's not possible to move to the attribute driver yet - Deprecation::ignoreDeprecations('https://github.com/doctrine/orm/issues/10098'); - } -} - -if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) { - if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) { - AnnotationRegistry::registerUniqueLoader('class_exists'); - } elseif (method_exists(AnnotationRegistry::class, 'registerLoader')) { - AnnotationRegistry::registerLoader('class_exists'); - } } if ( diff --git a/composer.json b/composer.json index de9101f7..d1e6c3ba 100644 --- a/composer.json +++ b/composer.json @@ -18,17 +18,13 @@ } ], "require": { - "php": ">=7.2.5 EVEN ON LATEST SYMFONY VERSIONS TO ALLOW USING", + "php": ">=8.1.0 EVEN ON LATEST SYMFONY VERSIONS TO ALLOW USING", "php": "THIS BRIDGE WHEN TESTING LOWEST SYMFONY VERSIONS.", - "php": ">=7.2.5" + "php": ">=8.1.0" }, "require-dev": { - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/error-handler": "^5.4|^6.4|^7.0", - "symfony/polyfill-php81": "^1.27" - }, - "conflict": { - "phpunit/phpunit": "<7.5|9.1.2" + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/error-handler": "^6.4.3|^7.0.3|^8.0" }, "autoload": { "files": [ "bootstrap.php" ], diff --git a/phpunit-9.6.xml.dist b/phpunit-9.6.xml.dist new file mode 100644 index 00000000..6f9542e1 --- /dev/null +++ b/phpunit-9.6.xml.dist @@ -0,0 +1,31 @@ + + + + + + + + + + ./Tests/ + ./Tests/DeprecationErrorHandler/ + + + + + + ./ + + + ./Tests + ./vendor + + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index cde576e2..7e310594 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,11 @@ @@ -19,7 +20,7 @@ - + ./ @@ -27,5 +28,5 @@ ./Tests ./vendor - +