Skip to content

Commit

Permalink
Removed assertEquals in favor of assertSame
Browse files Browse the repository at this point in the history
  • Loading branch information
mongkok committed May 3, 2020
1 parent d6fe10d commit f486720
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion tests/Exceptions/ApiExceptionTest.php
Expand Up @@ -15,6 +15,6 @@ public function testGetResponse()
$response = new Response($request);
$exc = new RESTfulException($response);

self::assertEquals($response, $exc->getResponse());
self::assertSame($response, $exc->getResponse());
}
}
2 changes: 1 addition & 1 deletion tests/Exceptions/GraphQLExceptionTest.php
Expand Up @@ -19,6 +19,6 @@ public function testGetErrors()
$response = new Response($request, 400, [], $body);
$exc = new GraphQLException($response);

self::assertEquals($errors, $exc->getErrors());
self::assertSame($errors, $exc->getErrors());
}
}
2 changes: 1 addition & 1 deletion tests/Exceptions/RESTfulExceptionTest.php
Expand Up @@ -20,6 +20,6 @@ public function testGetErrorCode()
$response = new Response($request, 400, [], $body);
$exc = new RESTfulException($response);

self::assertEquals('test', $exc->getErrorCode());
self::assertSame('test', $exc->getErrorCode());
}
}
12 changes: 6 additions & 6 deletions tests/Http/RequestTest.php
Expand Up @@ -11,13 +11,13 @@ class RequestTest extends TestCase
public function testGetMethod()
{
$request = new Request('get');
self::assertEquals('GET', $request->getMethod());
self::assertSame('GET', $request->getMethod());
}

public function testGetPath()
{
$request = new Request('GET', '/');
self::assertEquals('/', $request->getPath());
self::assertSame('/', $request->getPath());
}

public function testAuth()
Expand All @@ -26,7 +26,7 @@ public function testAuth()
$auth = ['user', 'password'];
$request->setAuth($auth);

self::assertEquals($auth, $request->getAuth());
self::assertSame($auth, $request->getAuth());
}

public function testHeaders()
Expand All @@ -35,7 +35,7 @@ public function testHeaders()
$headers = ['header' => true];
$request->setHeaders($headers);

self::assertEquals(
self::assertSame(
array_intersect($headers, $request->getHeaders()),
$headers
);
Expand All @@ -47,7 +47,7 @@ public function testParams()
$params = ['param' => true];
$request->setParams($params);

self::assertEquals(
self::assertSame(
array_intersect($params, $request->getParams()),
$params
);
Expand All @@ -71,7 +71,7 @@ public function testApiVersion()
$version = 'v1';
$request->setApiVersion($version);

self::assertEquals($version, $request->getApiVersion());
self::assertSame($version, $request->getApiVersion());
}

public function testIsGraphQL()
Expand Down
6 changes: 3 additions & 3 deletions tests/Http/ResponseTest.php
Expand Up @@ -20,7 +20,7 @@ public function testGetRequest()
{
$response = new Response($this->request);

self::assertEquals($this->request, $response->getRequest());
self::assertSame($this->request, $response->getRequest());
}

public function testGetStatusCode()
Expand All @@ -34,15 +34,15 @@ public function testGetHeaders()
$headers = ['test' => true];
$response = new Response($this->request, 200, $headers);

self::assertEquals($headers, $response->getHeaders());
self::assertSame($headers, $response->getHeaders());
}

public function testJson()
{
$json = ['test' => true];
$response = new Response($this->request, 200, [], json_encode($json));

self::assertEquals($json, $response->json());
self::assertSame($json, $response->json());
}

public function testIsError()
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/UrlTest.php
Expand Up @@ -13,12 +13,12 @@ public function testAddParamsToUrl()
$url = Url::addParamsToUrl('/', $params);
parse_str(parse_url($url, PHP_URL_QUERY), $result);

self::assertEquals($params, $result);
self::assertSame($params, $result);
}

public function testSlashPrefix()
{
$path = Url::slashPrefix('');
self::assertEquals($path, '/');
self::assertSame($path, '/');
}
}
2 changes: 1 addition & 1 deletion tests/HttpClients/ClientTest.php
Expand Up @@ -28,7 +28,7 @@ public function testSetClientHandler()
$clientHandler = Postpay::createClientHandler();
$client->setClientHandler($clientHandler);

self::assertEquals($clientHandler, $client->getClientHandler());
self::assertSame($clientHandler, $client->getClientHandler());
}

public function testRequest()
Expand Down
2 changes: 1 addition & 1 deletion tests/HttpClients/CurlClientTest.php
Expand Up @@ -52,6 +52,6 @@ public function testGetRequestHeaders()
$request->setHeaders(['test' => true]);
$headers = $curl->getRequestHeaders($request);

self::assertEquals('test: 1', $headers[0]);
self::assertSame('test: 1', $headers[0]);
}
}
14 changes: 7 additions & 7 deletions tests/PostpayTest.php
Expand Up @@ -62,42 +62,42 @@ public function testCreateClientHandler()
public function testGetLastResponse()
{
$response = $this->postpay->get('/');
self::assertEquals($response, $this->postpay->getLastResponse());
self::assertSame($response, $this->postpay->getLastResponse());
}

public function testGet()
{
$response = $this->postpay->get('/');
self::assertEquals('GET', $response->getRequest()->getMethod());
self::assertSame('GET', $response->getRequest()->getMethod());
}

public function testPost()
{
$response = $this->postpay->post('/');
self::assertEquals('POST', $response->getRequest()->getMethod());
self::assertSame('POST', $response->getRequest()->getMethod());
}

public function testPut()
{
$response = $this->postpay->put('/');
self::assertEquals('PUT', $response->getRequest()->getMethod());
self::assertSame('PUT', $response->getRequest()->getMethod());
}

public function testPatch()
{
$response = $this->postpay->patch('/');
self::assertEquals('PATCH', $response->getRequest()->getMethod());
self::assertSame('PATCH', $response->getRequest()->getMethod());
}

public function testDelete()
{
$response = $this->postpay->delete('/');
self::assertEquals('DELETE', $response->getRequest()->getMethod());
self::assertSame('DELETE', $response->getRequest()->getMethod());
}

public function testQuery()
{
$response = $this->postpay->query('{}');
self::assertEquals('POST', $response->getRequest()->getMethod());
self::assertSame('POST', $response->getRequest()->getMethod());
}
}
6 changes: 3 additions & 3 deletions tests/Serializers/DateTest.php
Expand Up @@ -20,16 +20,16 @@ public function testFromDate()
{
$datetime = new DateTime();
$date = Date::fromDate($datetime);

self::assertGreaterThan($date->toDateTime(), $datetime);
}

public function testJsonSerialize()
{
$datetime = new DateTime();
$date = Date::fromDateTime($datetime);
self::assertEquals(

self::assertSame(
$date->jsonSerialize(),
trim(json_encode($date), '"')
);
Expand Down
4 changes: 2 additions & 2 deletions tests/Serializers/DecimalTest.php
Expand Up @@ -19,8 +19,8 @@ public function testJsonSerialize()
{
$value = mt_rand();
$decimal = Decimal::fromFloat($value);
self::assertEquals(

self::assertSame(
$decimal->jsonSerialize(),
json_encode($decimal, JSON_NUMERIC_CHECK)
);
Expand Down

0 comments on commit f486720

Please sign in to comment.