コード例 #1
0
ファイル: Session.php プロジェクト: rmccue/requests
 public function testMultiple()
 {
     $session = new Requests_Session(httpbin('/'), array('X-Requests-Session' => 'Multiple'));
     $requests = array('test1' => array('url' => httpbin('/get')), 'test2' => array('url' => httpbin('/get')));
     $responses = $session->request_multiple($requests);
     // test1
     $this->assertNotEmpty($responses['test1']);
     $this->assertInstanceOf('Requests_Response', $responses['test1']);
     $this->assertEquals(200, $responses['test1']->status_code);
     $result = json_decode($responses['test1']->body, true);
     $this->assertEquals(httpbin('/get'), $result['url']);
     $this->assertEmpty($result['args']);
     // test2
     $this->assertNotEmpty($responses['test2']);
     $this->assertInstanceOf('Requests_Response', $responses['test2']);
     $this->assertEquals(200, $responses['test2']->status_code);
     $result = json_decode($responses['test2']->body, true);
     $this->assertEquals(httpbin('/get'), $result['url']);
     $this->assertEmpty($result['args']);
 }