public function test_create_from_response() { $response = new HttpResponse(); $response->setContent('foo'); $report = FakeReport::fromHttpResponse($response); $this->assertEquals('foo', $report->getContent()); }
public function test_set_complex_content() { $response = new HttpResponse(null, [new ArrayableItem('foo'), new ArrayableItem('bar')]); $this->assertEquals([['id' => 'foo'], ['id' => 'bar']], $response->getData()->toArray()); $response = new HttpResponse(); $response->setContent([new ArrayableItem('foo'), new ArrayableItem('bar')]); $this->assertEquals([['id' => 'foo'], ['id' => 'bar']], $response->getData()->toArray()); $response = new HttpResponse(); $response->getData()->setData([new ArrayableItem('foo'), new ArrayableItem('bar')]); $this->assertEquals([['id' => 'foo'], ['id' => 'bar']], $response->getData()->toArray()); }