InterNations\Component\HttpMock\Tests\AppIntegrationTest::testSimpleUseCase PHP Метод

testSimpleUseCase() публичный Метод

public testSimpleUseCase ( )
    public function testSimpleUseCase()
    {
        $response = $this->client->post('/_expectation', null, $this->createExpectationParams([static function ($request) {
            return $request instanceof Request;
        }], new Response('fake body', 200)))->send();
        $this->assertSame('', (string) $response->getBody());
        $this->assertSame(201, $response->getStatusCode());
        $response = $this->client->post('/foobar', ['X-Special' => 1], ['post' => 'data'])->send();
        $this->assertSame(200, $response->getStatusCode());
        $this->assertSame('fake body', (string) $response->getBody());
        $response = $this->client->get('/_request/latest')->send();
        /** @var EntityEnclosingRequest $request */
        $request = $this->parseRequestFromResponse($response);
        $this->assertSame('1', (string) $request->getHeader('X-Special'));
        $this->assertSame('post=data', (string) $request->getBody());
    }