From a53e0fe1cdce66ad9ebb9a25e661337e006dfb52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 6 Apr 2019 21:12:52 +0200 Subject: [PATCH] Use a class name that does not actually exist Using "Foo", a class name that corresponds to no less than 22 fixture classes, results in the first found "Foo" being loaded when one is found by the ClassNotFoundFatalErrorHandler error handler, I am not sure exactly why, but it is not really a big issue because this is a fatal error handler and execution is not supposed to continue after that. Except that is very much the case when running the whole test suite sequentially with ./phpunit . Then we arrive to the DI component test suite, and a failure happens because \\foo was not supposed to be defined: > Failed asserting that exception message 'The definition for "\foo" has > no class attribute, and appears to reference a class or interface in the > global namespace. Leaving out the "class" attribute is only allowed for > namespaced classes. Please specify the class attribute explicitly to get > rid of this error.' contains 'The definition for "\foo" has no class.'. --- src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index c1dea75bbd90..15de37c7b780 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -525,7 +525,7 @@ public function testHandleFatalError() */ public function testHandleErrorException() { - $exception = new \Error("Class 'Foo' not found"); + $exception = new \Error("Class 'IReallyReallyDoNotExistAnywhereInTheRepositoryISwear' not found"); $handler = new ErrorHandler(); $handler->setExceptionHandler(function () use (&$args) { @@ -535,7 +535,7 @@ public function testHandleErrorException() $handler->handleException($exception); $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $args[0]); - $this->assertStringStartsWith("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage()); + $this->assertStringStartsWith("Attempted to load class \"IReallyReallyDoNotExistAnywhereInTheRepositoryISwear\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage()); } /**