Skip to content

Commit

Permalink
Merge pull request #31 from peter279k/improve_assertions
Browse files Browse the repository at this point in the history
Making assertion equals strict
  • Loading branch information
fenric committed Nov 30, 2021
2 parents c550995 + 1a6f9fb commit 52dda1d
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function testSendRequest()
$request = (new RequestFactory)->createRequest('GET', $url);
$response = $client->sendRequest($request);
$this->assertInstanceOf(ResponseInterface::class, $response);
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('text/plain; charset=utf-8', $response->getHeaderLine('content-type'));
$this->assertSame(200, $response->getStatusCode());
$this->assertSame('text/plain; charset=utf-8', $response->getHeaderLine('content-type'));
$this->assertTrue($response->hasHeader('X-Request-Time'));
}

Expand All @@ -55,14 +55,14 @@ public function testSendRequests()
$responses = $client->sendRequests(...$requests);

$this->assertInstanceOf(ResponseInterface::class, $responses[0]);
$this->assertEquals(200, $responses[0]->getStatusCode());
$this->assertEquals('OK', $responses[0]->getReasonPhrase());
$this->assertEquals('text/plain; charset=utf-8', $responses[0]->getHeaderLine('content-type'));
$this->assertSame(200, $responses[0]->getStatusCode());
$this->assertSame('OK', $responses[0]->getReasonPhrase());
$this->assertSame('text/plain; charset=utf-8', $responses[0]->getHeaderLine('content-type'));
$this->assertTrue($responses[0]->hasHeader('X-Request-Time'));

$this->assertInstanceOf(ResponseInterface::class, $responses[1]);
$this->assertEquals(200, $responses[1]->getStatusCode());
$this->assertEquals('text/plain; charset=utf-8', $responses[1]->getHeaderLine('content-type'));
$this->assertSame(200, $responses[1]->getStatusCode());
$this->assertSame('text/plain; charset=utf-8', $responses[1]->getHeaderLine('content-type'));
$this->assertTrue($responses[1]->hasHeader('X-Request-Time'));
}

Expand All @@ -86,9 +86,9 @@ public function testClientException()
$this->assertInstanceOf(RuntimeException::class, $exception);
$this->assertInstanceOf(ClientExceptionInterface::class, $exception);

$this->assertEquals($message, $exception->getMessage());
$this->assertEquals($code, $exception->getCode());
$this->assertEquals($previous, $exception->getPrevious());
$this->assertSame($message, $exception->getMessage());
$this->assertSame($code, $exception->getCode());
$this->assertSame($previous, $exception->getPrevious());
}

public function testNetworkException()
Expand All @@ -102,10 +102,10 @@ public function testNetworkException()
$this->assertInstanceOf(ClientException::class, $exception);
$this->assertInstanceOf(NetworkExceptionInterface::class, $exception);

$this->assertEquals($request, $exception->getRequest());
$this->assertEquals($message, $exception->getMessage());
$this->assertEquals($code, $exception->getCode());
$this->assertEquals($previous, $exception->getPrevious());
$this->assertSame($request, $exception->getRequest());
$this->assertSame($message, $exception->getMessage());
$this->assertSame($code, $exception->getCode());
$this->assertSame($previous, $exception->getPrevious());
}

public function testRequestException()
Expand All @@ -119,9 +119,9 @@ public function testRequestException()
$this->assertInstanceOf(ClientException::class, $exception);
$this->assertInstanceOf(RequestExceptionInterface::class, $exception);

$this->assertEquals($request, $exception->getRequest());
$this->assertEquals($message, $exception->getMessage());
$this->assertEquals($code, $exception->getCode());
$this->assertEquals($previous, $exception->getPrevious());
$this->assertSame($request, $exception->getRequest());
$this->assertSame($message, $exception->getMessage());
$this->assertSame($code, $exception->getCode());
$this->assertSame($previous, $exception->getPrevious());
}
}

0 comments on commit 52dda1d

Please sign in to comment.