File tree Expand file tree Collapse file tree 2 files changed +53
-1
lines changed
src/Symfony/Component/ClassLoader Expand file tree Collapse file tree 2 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public static function enable()
5353 }
5454
5555 foreach ($ functions as $ function ) {
56- if (is_array ($ function ) && method_exists ($ function [0 ], 'findFile ' )) {
56+ if (is_array ($ function ) && ! $ function [ 0 ] instanceof self && method_exists ($ function [0 ], 'findFile ' )) {
5757 $ function = array (new static ($ function [0 ]), 'loadClass ' );
5858 }
5959
@@ -104,4 +104,9 @@ public function loadClass($class)
104104 return true ;
105105 }
106106 }
107+
108+ public function getClassFinder ()
109+ {
110+ return $ this ->classFinder ;
111+ }
107112}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the Symfony package.
5+ *
6+ * (c) Fabien Potencier <[email protected] > 7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ namespace Symfony \Component \ClassLoader \Tests ;
13+
14+ use Symfony \Component \ClassLoader \DebugClassLoader ;
15+ use Symfony \Component \ClassLoader \UniversalClassLoader ;
16+
17+ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase
18+ {
19+ private $ loader ;
20+
21+ protected function setUp ()
22+ {
23+ $ this ->loader = new UniversalClassLoader ();
24+ spl_autoload_register (array ($ this ->loader , 'loadClass ' ));
25+ }
26+
27+ protected function tearDown ()
28+ {
29+ spl_autoload_unregister (array ($ this ->loader , 'loadClass ' ));
30+ }
31+
32+ public function testIdempotence ()
33+ {
34+ DebugClassLoader::enable ();
35+ DebugClassLoader::enable ();
36+
37+ $ functions = spl_autoload_functions ();
38+ foreach ($ functions as $ function ) {
39+ if (is_array ($ function ) && $ function [0 ] instanceof DebugClassLoader) {
40+ $ this ->assertNotInstanceOf ('Symfony\Component\ClassLoader\DebugClassLoader ' , $ function [0 ]->getClassFinder ());
41+ return ;
42+ }
43+ }
44+
45+ throw new \Exception ('DebugClassLoader did not register ' );
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments