/** * @runInSeparateProcess */ public function testCase02() { if (!defined('YAF_MODE')) { //@todo for some reason this need to b true to pass the test Yaf_G::iniSet('yaf.use_spl_autoload', true); Yaf_G::iniSet('yaf.lowcase_path', false); } else { ini_set('yaf.use_spl_autoload', false); ini_set('yaf.lowcase_path', false); } $this->assertEquals('CLI', $this->request->getMethod()); $this->assertEquals('index', $this->request->getModuleName()); $this->assertEquals('dummy', $this->request->getControllerName()); $this->assertEquals('index', $this->request->getActionName()); $this->assertFalse($this->request->isDispatched()); $this->assertTrue($this->request->isRouted()); $this->request->setParam('name', 'Laruence'); $this->assertEquals('Laruence', $this->request->getParam('name')); $this->assertNull($this->request->getParam('non-exists')); $this->assertTrue($this->request->isCli()); $app = new Yaf_Application(array("application" => array("directory" => dirname(__FILE__)))); try { $app->getDispatcher()->dispatch($this->request); $this->fail('An Yaf_Exception_LoadFailed_Controller ' . 'exception was not throwed'); } catch (Exception $e) { $this->assertEquals('Could not find controller script ' . dirname(__FILE__) . '/controllers/Dummy.php', $e->getMessage()); } }
/** * @runaInSeparateProcess */ public function testCase027() { $globalDir = '/php/global/dir'; if (!defined('YAF_MODE')) { Yaf_G::iniSet('yaf.library', $globalDir); Yaf_G::iniSet('yaf.use_spl_autoload', false); } else { ini_set('yaf.library', $globalDir); ini_set('yaf.use_spl_autoload', false); } $config = array("application" => array("directory" => TEST_APPLICATION_PATH . 'application/', "dispatcher" => array("catchException" => 0, "throwException" => 0))); $app = new Yaf_Application($config); include dirname(__FILE__) . '/Loader/testCase027.php'; try { $app->execute('testCase027'); } catch (PHPUnit_Framework_Error_Warning $e) { $this->assertContains('Could not find script ' . TEST_APPLICATION_PATH . 'application/controllers/NoExists.php', $e->getMessage()); } }
public function testBug62702() { if (!defined('YAF_MODE')) { Yaf_G::iniSet('yaf.action_prefer', false); } else { ini_set('yaf.action_prefer', false); } $router = new Yaf_Route_Static(); $request = new Yaf_Request_Http("/sample", "/sample"); $router->route($request); $this->assertNull($request->getControllerName()); if (defined('YAF_MODE')) { echo PHP_EOL . 'Yaf this version does not support this test'; } else { $request = new Yaf_Request_Http("/Sample/ABC", "/sample"); $router->route($request); $this->assertEquals('ABC', $request->getControllerName()); } $router = new Yaf_Route_Map(true); $request = new Yaf_Request_Http("/sample/A/B/C", "/sample"); $router->route($request); $this->assertEquals('A_B_C', $request->getControllerName()); $request = new Yaf_Request_Http("/sample", "/sAmplE"); $router->route($request); $this->assertNull($request->getControllerName()); $router = new Yaf_Route_Regex("#^/test#", array("controller" => "info"), array()); $request = new Yaf_Request_Http("/test/", "/Test"); $router->route($request); $this->assertNull($request->getControllerName()); $request = new Yaf_Request_Http("/sample/test", "/sAmplE"); $router->route($request); $this->assertEquals('info', $request->getControllerName()); $router = new Yaf_Route_Rewrite("/test", array("controller" => "info"), array()); $request = new Yaf_Request_Http("/test/", "/Test"); $router->route($request); $this->assertNull($request->getControllerName()); $request = new Yaf_Request_Http("/sample/test", "/sAmplE"); $router->route($request); $this->assertEquals('info', $request->getControllerName()); }
/** * @runInSeparateProcess */ public function testCase037() { //ini_set('open_basedir', '.'); //unfortunately setting open_basedir will make //phpunit to not work $globalDir = '/tmp/'; if (!defined('YAF_MODE')) { Yaf_G::iniSet('yaf.library', $globalDir); Yaf_G::iniSet('yaf.lowcase_path', false); } else { ini_set('yaf.library', $globalDir); ini_set('yaf.lowcase_path', false); } $this->loader = Yaf_Loader::getInstance('/tmp'); $this->loader->import("/tmp/1.php"); try { $this->loader->autoload("Foo_Bar"); } catch (PHPUnit_Framework_Error_Warning $e) { $this->assertContains('Could not find script /tmp/Foo/Bar.php', $e->getMessage()); } }