本文整理匯總了PHP中core_component::classloader方法的典型用法代碼示例。如果您正苦於以下問題:PHP core_component::classloader方法的具體用法?PHP core_component::classloader怎麽用?PHP core_component::classloader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core_component
的用法示例。
在下文中一共展示了core_component::classloader方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: test_classloader
/**
* 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));
}