コード例 #1
0
ファイル: RequestTest.php プロジェクト: arvici/framework
 /**
  * Get spoofed request class instance
  *
  * @param string $url
  * @param string $method
  * @param array $post
  * @return \Arvici\Heart\Http\Request
  */
 private function spoofedRequest($url, $method = 'get', $post = array())
 {
     TestUtils::clear();
     //$url = '/get/test?param1=1&param2=yes&param3[]=1&param3[]=2&param3[]=3';
     $urlparts = parse_url($url);
     parse_str($urlparts['query'], $get);
     TestUtils::spoofUrl($url, $method, $get, $post);
     return Http::getInstance()->request();
 }
コード例 #2
0
ファイル: ResponseTest.php プロジェクト: arvici/framework
 /**
  * Get fresh clean response class instance.
  *
  * @return \Arvici\Heart\Http\Response
  */
 private function getResponse()
 {
     TestUtils::clear();
     return Http::getInstance()->response();
 }
コード例 #3
0
ファイル: RouterTest.php プロジェクト: arvici/framework
 /**
  * @covers \Arvici\Heart\Router\Router
  * @covers \Arvici\Heart\Router\Route
  * @covers \Arvici\Heart\Http\Http
  * @covers \Arvici\Heart\Http\Request
  * @covers \Arvici\Heart\Http\Response
  */
 public function testQueryParameters()
 {
     TestUtils::clear();
     $router = Router::getInstance();
     $router->addRoute(new Route('/test/get/controller/query', 'GET', 'App\\Controller\\TestQuery::basicQuery'));
     $this->spoof('/test/get/controller/query?test=yes', 'GET', array('test' => 'yes'));
     try {
         $router->run();
         $this->assertTrue(false);
     } catch (\Exception $e) {
         $this->assertEquals(999, $e->getCode());
     }
     // Test via request object (right here)
     $request = Http::getInstance()->request();
     $this->assertEquals(array('test' => 'yes'), $request->get()->all());
     // More testing on REQUEST is done in a separate case
 }