class Psr4ClassLoaderTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/class-loader/Tests/Psr4ClassLoaderTest.php \Symfony\Component\ClassLoader\Tests\Psr4ClassLoaderTest
Hierarchy
- class \Symfony\Component\ClassLoader\Tests\Psr4ClassLoaderTest extends \Symfony\Component\ClassLoader\Tests\PHPUnit_Framework_TestCase
Expanded class hierarchy of Psr4ClassLoaderTest
File
- vendor/
symfony/ class-loader/ Tests/ Psr4ClassLoaderTest.php, line 16
Namespace
Symfony\Component\ClassLoader\TestsView source
class Psr4ClassLoaderTest extends \PHPUnit_Framework_TestCase {
/**
* @param string $className
* @dataProvider getLoadClassTests
*/
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));
}
/**
* @return array
*/
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',
),
);
}
/**
* @param string $className
* @dataProvider getLoadNonexistentClassTests
*/
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));
}
/**
* @return array
*/
public function getLoadNonexistentClassTests() {
return array(
array(
'Acme\\DemoLib\\I_Do_Not_Exist',
),
array(
'UnknownVendor\\SomeLib\\I_Do_Not_Exist',
),
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Psr4ClassLoaderTest:: |
public | function | ||
Psr4ClassLoaderTest:: |
public | function | ||
Psr4ClassLoaderTest:: |
public | function | @dataProvider getLoadClassTests | |
Psr4ClassLoaderTest:: |
public | function | @dataProvider getLoadNonexistentClassTests |