/** * @dataProvider find_uri_provider * @test */ public function find_uri($request_uri, $current_uri, $servers) { if (PHP_SAPI === 'cli') { $this->markTestSkipped(); } foreach ($servers as $vars) { $_SERVER = array_merge($this->server_vars, array('ORIG_PATH_INFO' => NULL, 'PATH_INFO' => NULL, 'PHP_SELF' => NULL, 'REQUEST_URI' => $request_uri, 'SCRIPT_NAME' => NULL), $vars); Router::find_uri(); $this->assertEquals($current_uri, Router::$current_uri); } }
/** * @test */ public function find_uri_suffix() { Kohana::$server_api = 'cgi-fcgi'; Kohana_Config::instance()->set('core.url_suffix', '.html'); $_SERVER = array_merge($_SERVER, array('ORIG_PATH_INFO' => NULL, 'PATH_INFO' => '/default/index.html', 'PHP_SELF' => '/' . KOHANA . '/default/index.html', 'REQUEST_URI' => '/default/index.html', 'QUERY_STRING' => NULL, 'SCRIPT_NAME' => '/' . KOHANA)); Router::find_uri(); $this->assertEquals('default/index', Router::$current_uri); $this->assertEquals('.html', Router::$url_suffix); }