[Debug] Remove false-positive check in DebugClassLoader
This commit is contained in:
parent
3ba4112009
commit
466da3fd63
|
@ -26,6 +26,7 @@ class DebugClassLoader
|
||||||
{
|
{
|
||||||
private $classLoader;
|
private $classLoader;
|
||||||
private $isFinder;
|
private $isFinder;
|
||||||
|
private $loaded = array();
|
||||||
private $wasFinder;
|
private $wasFinder;
|
||||||
private static $caseCheck;
|
private static $caseCheck;
|
||||||
private static $deprecated = array();
|
private static $deprecated = array();
|
||||||
|
@ -164,9 +165,10 @@ class DebugClassLoader
|
||||||
ErrorHandler::stackErrors();
|
ErrorHandler::stackErrors();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($this->isFinder) {
|
if ($this->isFinder && !isset($this->loaded[$class])) {
|
||||||
|
$this->loaded[$class] = true;
|
||||||
if ($file = $this->classLoader[0]->findFile($class)) {
|
if ($file = $this->classLoader[0]->findFile($class)) {
|
||||||
require_once $file;
|
require $file;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
call_user_func($this->classLoader, $class);
|
call_user_func($this->classLoader, $class);
|
||||||
|
|
|
@ -59,6 +59,23 @@ class DebugClassLoaderTest extends TestCase
|
||||||
$this->fail('DebugClassLoader did not register');
|
$this->fail('DebugClassLoader did not register');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \Exception
|
||||||
|
* @expectedExceptionMessage boo
|
||||||
|
*/
|
||||||
|
public function testThrowingClass()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
class_exists(__NAMESPACE__.'\Fixtures\Throwing');
|
||||||
|
$this->fail('Exception expected');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->assertSame('boo', $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// the second call also should throw
|
||||||
|
class_exists(__NAMESPACE__.'\Fixtures\Throwing');
|
||||||
|
}
|
||||||
|
|
||||||
public function testUnsilencing()
|
public function testUnsilencing()
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
|
@ -128,6 +145,7 @@ class DebugClassLoaderTest extends TestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \RuntimeException
|
* @expectedException \RuntimeException
|
||||||
|
* @expectedExceptionMessage Case mismatch between loaded and declared class names
|
||||||
*/
|
*/
|
||||||
public function testNameCaseMismatch()
|
public function testNameCaseMismatch()
|
||||||
{
|
{
|
||||||
|
@ -149,6 +167,7 @@ class DebugClassLoaderTest extends TestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \RuntimeException
|
* @expectedException \RuntimeException
|
||||||
|
* @expectedExceptionMessage Case mismatch between loaded and declared class names
|
||||||
*/
|
*/
|
||||||
public function testPsr4CaseMismatch()
|
public function testPsr4CaseMismatch()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
throw new \Exception('boo');
|
Reference in New Issue