public function testWriteRequestWithPostBody() { $request = (new Request('/endpoint'))->withMethod('POST')->withHeader('Content-Type', 'application/json'); $request->getBody()->write(json_encode(['data' => 'test', 'other_data' => 'test2'])); $expected = "URL: /endpoint\n"; $expected .= "METHOD: POST\n"; $expected .= "HEADERS: Content-Type: application/json\n\n"; $expected .= "BODY:{\n"; $expected .= " \"data\": \"test\",\n"; $expected .= " \"other_data\": \"test2\"\n"; $expected .= "}\n"; $this->expectOutputString($expected); $this->output->writeRequest($request); }
public function testEmptyLine() { $this->expectOutputString("\n"); $this->output->emptyLine(); }