Esempio n. 1
0
 /**
  * @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());
     }
 }