Exemplo n.º 1
0
 public function testEchoBackSpray()
 {
     $response = array('echo_back' => 'content');
     Spray::stub('foo://bar', $response);
     $content = 'this is some content to be echod back';
     $context = stream_context_create(array('foo' => array('content' => $content)));
     $this->assertEquals($content, file_get_contents('foo://bar', false, $context));
 }
Exemplo n.º 2
0
 public function testStubAndReset()
 {
     Spray::stub('test://path', array('body' => 'foo'));
     Spray::stub('http://url', array('body' => 'bar'));
     $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());
 }
Exemplo n.º 3
0
 private function stubResponse($body)
 {
     Spray::stub($this->fake_uri, array('raw' => $body));
 }
Exemplo n.º 4
0
 public function setUp()
 {
     $this->input_url = 'junior://input';
     Spray::stub($this->input_url, array('body' => 'foo'));
 }
Exemplo n.º 5
0
 private function setRequest($json)
 {
     Spray::stub('php://input', array('raw' => $json));
 }