ExtensionsTest.php in Autoload 7.2
File
src/Tests/Unit/ExtensionsTest.php
View source
<?php
namespace Drupal\autoload\Tests\Unit;
class ExtensionsTest extends AutoloadTestBase {
protected static $modules = array(
'autoload_test_extensions',
);
public static function getInfo() {
return static::info(t('Ensure registered file extensions are available for autoloading.'));
}
public function test() {
$this
->assertExtensions(array(
'.php',
'.inc',
));
spl_autoload_extensions('.test');
$this
->assertExtensions(array(
'.php',
'.inc',
'.test',
));
$this
->assertFalse(class_exists('Drupal\\autoload_test_extensions\\PSR4'), 'A class cannot be loaded despite on registered file extension.');
}
protected function assertExtensions(array $extensions) {
$this
->assertFalse(array_diff(autoload_extensions(), $extensions), 'Required extensions available.');
}
}