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)); }
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()); }
private function stubResponse($body) { Spray::stub($this->fake_uri, array('raw' => $body)); }
public function setUp() { $this->input_url = 'junior://input'; Spray::stub($this->input_url, array('body' => 'foo')); }
private function setRequest($json) { Spray::stub('php://input', array('raw' => $json)); }