Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e9b10af

Browse filesBrowse files
committed
Enabling the DebugClassLoader available
1 parent ca9ad2b commit e9b10af
Copy full SHA for e9b10af

File tree

3 files changed

+20
-11
lines changed
Filter options

3 files changed

+20
-11
lines changed

‎src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use PHPUnit\Util\Blacklist;
1919
use Symfony\Bridge\PhpUnit\ClockMock;
2020
use Symfony\Bridge\PhpUnit\DnsMock;
21+
use Symfony\Component\Debug\DebugClassLoader as LegacyDebugClassLoader;
2122
use Symfony\Component\ErrorHandler\DebugClassLoader;
2223

2324
/**
@@ -53,7 +54,7 @@ public function __construct(array $mockedNamespaces = array())
5354
Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait'] = 2;
5455
}
5556

56-
$enableDebugClassLoader = class_exists('Symfony\Component\ErrorHandler\DebugClassLoader');
57+
$enableDebugClassLoader = class_exists('Symfony\Component\ErrorHandler\DebugClassLoader') || class_exists('Symfony\Component\Debug\DebugClassLoader');
5758

5859
foreach ($mockedNamespaces as $type => $namespaces) {
5960
if (!\is_array($namespaces)) {
@@ -74,7 +75,11 @@ public function __construct(array $mockedNamespaces = array())
7475
}
7576
}
7677
if ($enableDebugClassLoader) {
77-
DebugClassLoader::enable();
78+
if (class_exists(DebugClassLoader::class)) {
79+
DebugClassLoader::enable();
80+
} else {
81+
LegacyDebugClassLoader::enable();
82+
}
7883
}
7984
if (self::$globallyEnabled) {
8085
$this->state = -2;

‎src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function provideClassNotFoundData()
7474
{
7575
$autoloader = new ComposerClassLoader();
7676
$autoloader->add('Symfony\Component\Debug\Exception\\', realpath(__DIR__.'/../../Exception'));
77+
$autoloader->add('Symfony_Component_Debug_Tests_Fixtures', realpath(__DIR__.'/../../Tests/Fixtures'));
7778

7879
$debugClassLoader = new DebugClassLoader([$autoloader, 'loadClass']);
7980

@@ -103,7 +104,8 @@ public function provideClassNotFoundData()
103104
'file' => 'foo.php',
104105
'message' => 'Class \'UndefinedFunctionException\' not found',
105106
],
106-
"Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement?",
107+
"Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
108+
[$debugClassLoader, 'loadClass'],
107109
],
108110
[
109111
[
@@ -112,7 +114,8 @@ public function provideClassNotFoundData()
112114
'file' => 'foo.php',
113115
'message' => 'Class \'PEARClass\' not found',
114116
],
115-
"Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement?",
117+
"Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"?",
118+
[$debugClassLoader, 'loadClass'],
116119
],
117120
[
118121
[
@@ -121,7 +124,8 @@ public function provideClassNotFoundData()
121124
'file' => 'foo.php',
122125
'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found',
123126
],
124-
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for another namespace?",
127+
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
128+
[$debugClassLoader, 'loadClass'],
125129
],
126130
[
127131
[

‎src/Symfony/Component/ErrorHandler/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ public static function setUpBeforeClass()
4040

4141
/**
4242
* @dataProvider provideClassNotFoundData
43-
*
44-
* Remove only the "@group" annotation in 5.0 when the Debug component is gone.
45-
*
46-
* @group legacy
4743
*/
4844
public function testHandleClassNotFound($error, $translatedMessage, $autoloader = null)
4945
{
@@ -75,6 +71,7 @@ public function provideClassNotFoundData()
7571
{
7672
$autoloader = new ComposerClassLoader();
7773
$autoloader->add('Symfony\Component\ErrorHandler\Exception\\', realpath(__DIR__.'/../../Exception'));
74+
$autoloader->add('Symfony_Component_ErrorHandler_Tests_Fixtures', realpath(__DIR__.'/../../Tests/Fixtures'));
7875

7976
$debugClassLoader = new DebugClassLoader([$autoloader, 'loadClass']);
8077

@@ -104,7 +101,8 @@ public function provideClassNotFoundData()
104101
'file' => 'foo.php',
105102
'message' => 'Class \'UndefinedFunctionException\' not found',
106103
],
107-
"Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for e.g. \"Symfony\Component\ErrorHandler\Exception\UndefinedFunctionException\" or \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
104+
"Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony\Component\ErrorHandler\Exception\UndefinedFunctionException\"?",
105+
[$debugClassLoader, 'loadClass'],
108106
],
109107
[
110108
[
@@ -114,6 +112,7 @@ public function provideClassNotFoundData()
114112
'message' => 'Class \'PEARClass\' not found',
115113
],
116114
"Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_ErrorHandler_Tests_Fixtures_PEARClass\"?",
115+
[$debugClassLoader, 'loadClass'],
117116
],
118117
[
119118
[
@@ -122,7 +121,8 @@ public function provideClassNotFoundData()
122121
'file' => 'foo.php',
123122
'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found',
124123
],
125-
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for e.g. \"Symfony\Component\ErrorHandler\Exception\UndefinedFunctionException\" or \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
124+
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\ErrorHandler\Exception\UndefinedFunctionException\"?",
125+
[$debugClassLoader, 'loadClass'],
126126
],
127127
[
128128
[

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.