InterNations\Component\HttpMock\Tests\PHPUnit\HttpMockPHPUnitIntegrationTest::testPostRequest PHP Method

testPostRequest() public method

public testPostRequest ( )
    public function testPostRequest()
    {
        $this->http->mock->when()->methodIs('POST')->then()->body('BODY')->statusCode(201)->header('X-Foo', 'Bar')->end();
        $this->http->setUp();
        $response = $this->http->client->post('/', ['x-client-header' => 'header-value'], ['post-key' => 'post-value'])->send();
        $this->assertSame('BODY', $response->getBody(true));
        $this->assertSame(201, $response->getStatusCode());
        $this->assertSame('Bar', (string) $response->getHeader('X-Foo'));
        $this->assertSame('post-value', $this->http->requests->latest()->getPostField('post-key'));
    }