Psr4ClassLoaderTest.php in Zircon Profile 8.0
File
vendor/symfony/class-loader/Tests/Psr4ClassLoaderTest.php
View source
<?php
namespace Symfony\Component\ClassLoader\Tests;
use Symfony\Component\ClassLoader\Psr4ClassLoader;
class Psr4ClassLoaderTest extends \PHPUnit_Framework_TestCase {
public function testLoadClass($className) {
$loader = new Psr4ClassLoader();
$loader
->addPrefix('Acme\\DemoLib', __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'psr-4');
$loader
->loadClass($className);
$this
->assertTrue(class_exists($className), sprintf('loadClass() should load %s', $className));
}
public function getLoadClassTests() {
return array(
array(
'Acme\\DemoLib\\Foo',
),
array(
'Acme\\DemoLib\\Class_With_Underscores',
),
array(
'Acme\\DemoLib\\Lets\\Go\\Deeper\\Foo',
),
array(
'Acme\\DemoLib\\Lets\\Go\\Deeper\\Class_With_Underscores',
),
);
}
public function testLoadNonexistentClass($className) {
$loader = new Psr4ClassLoader();
$loader
->addPrefix('Acme\\DemoLib', __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'psr-4');
$loader
->loadClass($className);
$this
->assertFalse(class_exists($className), sprintf('loadClass() should not load %s', $className));
}
public function getLoadNonexistentClassTests() {
return array(
array(
'Acme\\DemoLib\\I_Do_Not_Exist',
),
array(
'UnknownVendor\\SomeLib\\I_Do_Not_Exist',
),
);
}
}