Пример #1
0
 public function testRegexSpray()
 {
     $response = array('status' => Spray::STATUS_200, 'headers' => array("connection" => "close"), 'body' => "{foo: bar}");
     Spray::regexStub('http', '`test/.*`', $response);
     $expected = "HTTP/1.0 200 OK\r\nconnection: close\r\n\r\n{foo: bar}";
     $this->assertEquals($expected, file_get_contents('http://test/some_url?foo=bar#frag'));
 }
Пример #2
0
 public function testRegexStub()
 {
     Spray::regexStub('test', '`foo/.*`', array('body' => 'bar'));
     Spray::regexStub('http', '/(bar|baz)/', array('body' => 'wtf'));
     $this->assertContains('test', stream_get_wrappers());
     $this->assertContains('http', stream_get_wrappers());
     Spray::reset();
     $this->assertNotContains('test', stream_get_wrappers());
     $this->assertContains('http', stream_get_wrappers());
 }
Пример #3
0
 private function stubResponse($body)
 {
     Spray::stub($this->fake_uri, array('raw' => $body));
 }
Пример #4
0
 public function tearDown()
 {
     Spray::reset();
 }
Пример #5
0
 private function setRequest($json)
 {
     Spray::stub('php://input', array('raw' => $json));
 }