コード例 #1
0
ファイル: IntegrationTest.php プロジェクト: jimbojsb/spray
 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
ファイル: SprayStaticTest.php プロジェクト: jimbojsb/spray
 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());
 }