/** * Test the classloader. * * @dataProvider classloader_provider * @param array $psr0 The PSR-0 namespaces to be used in the test. * @param array $psr4 The PSR-4 namespaces to be used in the test. * @param string $classname The name of the class to attempt to load. * @param string $includedfiles The file expected to be loaded. */ public function test_classloader($psr0, $psr4, $classname, $includedfiles) { $psr0namespaces = new ReflectionProperty('core_component', 'psr0namespaces'); $psr0namespaces->setAccessible(true); $psr0namespaces->setValue(null, $psr0); $psr4namespaces = new ReflectionProperty('core_component', 'psr4namespaces'); $psr4namespaces->setAccessible(true); $psr4namespaces->setValue(null, $psr4); core_component::classloader($classname); if (DIRECTORY_SEPARATOR != '/') { // Denormalise the expected path so that we can quickly compare with get_included_files. $includedfiles = str_replace('/', DIRECTORY_SEPARATOR, $includedfiles); } $this->assertContains($includedfiles, get_included_files()); $this->assertTrue(class_exists($classname, false)); }