Skip to content

Commit 52dda1d

Browse files
authored
Merge pull request #31 from peter279k/improve_assertions
Making assertion equals strict
2 parents c550995 + 1a6f9fb commit 52dda1d

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

tests/ClientTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function testSendRequest()
3434
$request = (new RequestFactory)->createRequest('GET', $url);
3535
$response = $client->sendRequest($request);
3636
$this->assertInstanceOf(ResponseInterface::class, $response);
37-
$this->assertEquals(200, $response->getStatusCode());
38-
$this->assertEquals('text/plain; charset=utf-8', $response->getHeaderLine('content-type'));
37+
$this->assertSame(200, $response->getStatusCode());
38+
$this->assertSame('text/plain; charset=utf-8', $response->getHeaderLine('content-type'));
3939
$this->assertTrue($response->hasHeader('X-Request-Time'));
4040
}
4141

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

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

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

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

89-
$this->assertEquals($message, $exception->getMessage());
90-
$this->assertEquals($code, $exception->getCode());
91-
$this->assertEquals($previous, $exception->getPrevious());
89+
$this->assertSame($message, $exception->getMessage());
90+
$this->assertSame($code, $exception->getCode());
91+
$this->assertSame($previous, $exception->getPrevious());
9292
}
9393

9494
public function testNetworkException()
@@ -102,10 +102,10 @@ public function testNetworkException()
102102
$this->assertInstanceOf(ClientException::class, $exception);
103103
$this->assertInstanceOf(NetworkExceptionInterface::class, $exception);
104104

105-
$this->assertEquals($request, $exception->getRequest());
106-
$this->assertEquals($message, $exception->getMessage());
107-
$this->assertEquals($code, $exception->getCode());
108-
$this->assertEquals($previous, $exception->getPrevious());
105+
$this->assertSame($request, $exception->getRequest());
106+
$this->assertSame($message, $exception->getMessage());
107+
$this->assertSame($code, $exception->getCode());
108+
$this->assertSame($previous, $exception->getPrevious());
109109
}
110110

111111
public function testRequestException()
@@ -119,9 +119,9 @@ public function testRequestException()
119119
$this->assertInstanceOf(ClientException::class, $exception);
120120
$this->assertInstanceOf(RequestExceptionInterface::class, $exception);
121121

122-
$this->assertEquals($request, $exception->getRequest());
123-
$this->assertEquals($message, $exception->getMessage());
124-
$this->assertEquals($code, $exception->getCode());
125-
$this->assertEquals($previous, $exception->getPrevious());
122+
$this->assertSame($request, $exception->getRequest());
123+
$this->assertSame($message, $exception->getMessage());
124+
$this->assertSame($code, $exception->getCode());
125+
$this->assertSame($previous, $exception->getPrevious());
126126
}
127127
}

0 commit comments

Comments
 (0)