本文整理匯總了PHP中Yaf_Loader::setLibraryPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Yaf_Loader::setLibraryPath方法的具體用法?PHP Yaf_Loader::setLibraryPath怎麽用?PHP Yaf_Loader::setLibraryPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Yaf_Loader
的用法示例。
在下文中一共展示了Yaf_Loader::setLibraryPath方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testCase023
/**
* @runInSeparateProcess
*/
public function testCase023()
{
if (!defined('YAF_MODE')) {
Yaf_G::iniSet('yaf.use_spl_autoload', false);
Yaf_G::iniSet('yaf.lowcase_path', false);
} else {
ini_set('yaf.use_spl_autoload', false);
ini_set('yaf.lowcase_path', false);
}
$this->setUpLoader();
$this->loader->registerLocalNamespace(array('Foo'));
try {
$this->loader->autoload('Foo_Bar');
} catch (PHPUnit_Framework_Error_Warning $e) {
$this->assertContains('Could not find script ' . TEST_APPLICATION_PATH . '_files/Foo/Bar.php', $e->getMessage());
}
try {
$this->loader->autoload('Bar_Foo');
} catch (PHPUnit_Framework_Error_Warning $e) {
$this->assertContains('Could not find script ' . TEST_APPLICATION_PATH . '_files/global/Bar/Foo.php', $e->getMessage());
}
$this->loader->setLibraryPath('/foobar', false);
try {
$this->loader->autoload('Foo_Bar');
} catch (PHPUnit_Framework_Error_Warning $e) {
$this->assertContains('Could not find script /foobar/Foo/Bar.php', $e->getMessage());
}
try {
$this->loader->autoload('Bar_Foo');
} catch (PHPUnit_Framework_Error_Warning $e) {
$this->assertContains('Could not find script ' . TEST_APPLICATION_PATH . '_files/global/Bar/Foo.php', $e->getMessage());
}
$this->loader->setLibraryPath('/foobar', true);
try {
$this->loader->autoload('Foo_Bar');
} catch (PHPUnit_Framework_Error_Warning $e) {
$this->assertContains('Could not find script /foobar/Foo/Bar.php', $e->getMessage());
}
try {
$this->loader->autoload('Bar_Foo');
} catch (PHPUnit_Framework_Error_Warning $e) {
$this->assertContains('Could not find script /foobar/Bar/Foo.php', $e->getMessage());
}
try {
$this->loader->autoload('Bar_Model');
} catch (PHPUnit_Framework_Error_Warning $e) {
$this->assertContains('Couldn\'t load a framework MVC class without ' . 'an Yaf_Application initializing', $e->getMessage());
}
}