CustomTest.php in Autoload 7.2
File
src/Tests/Unit/CustomTest.php
View source
<?php
namespace Drupal\autoload\Tests\Unit;
class CustomTest extends AutoloadTestBase {
protected static $modules = array(
'autoload_test_custom',
);
public static function getInfo() {
return static::info(t('Testing functionality of autoloading custom namespaces.'));
}
public function test() {
new \Autoload\Tests\PSR0();
new \Autoload\Tests\PSR4();
new \AutoloadTests\PSR4();
new \Autoload\Tests\Example\Test();
$autoload = autoload();
$this
->assertFalse(isset($autoload['AutoloadWrongNamespace\\WrongNamespace']), 'A correct class does not exist in the autoloading map due to a wrong autoloading declaration.');
$this
->assertFalse(class_exists('AutoloadWrongNamespace\\WrongNamespace'), 'A class cannot be loaded because of wrongly defined autoloading.');
$this
->assertTrue(isset($autoload['Autoload\\WrongNamespace\\WrongNamespace']), 'A non-existent class within the autoloading map because autoloading was wrongly declared.');
$this
->assertFalse(class_exists('Autoload\\WrongNamespace\\WrongNamespace'), 'Cannot load non-existent class even if it is defined in a class map.');
$this
->assertTrue(class_exists('AutoloadWrongNamespace\\WrongNamespace'), 'A correct class became available because of including the file during appealing to non-existent class.');
}
}