diff --git a/tests/AuthorizationTest.php b/tests/AuthorizationTest.php index 0494525..89a2469 100644 --- a/tests/AuthorizationTest.php +++ b/tests/AuthorizationTest.php @@ -52,7 +52,7 @@ public function testAuthorizationProviderInteraction(): void ]); self::assertTrue($request->hasHeader('Authorization'), 'Authorization header not available'); - self::assertEquals(['am9obmRvZTpzZWNyZXQ='], $request->getHeader('Authorization')); + self::assertSame('am9obmRvZTpzZWNyZXQ=', $request->getHeaderLine('Authorization')); } /** diff --git a/tests/BasicTest.php b/tests/BasicTest.php index 09d5b5d..3cc08c7 100644 --- a/tests/BasicTest.php +++ b/tests/BasicTest.php @@ -21,7 +21,7 @@ public function setUp(): void public function testApiHost(): void { $request = (new ApiRequestFactory($this->uri))->create(['resource' => 'user']); - self::assertEquals(['api.example.com'], $request->getHeader('Host')); + self::assertSame('api.example.com', $request->getHeaderLine('Host')); } public function testResourceInUrl(): void @@ -29,7 +29,7 @@ public function testResourceInUrl(): void $request = (new ApiRequestFactory($this->uri))->create(['resource' => 'user']); $uri = $request->getUri(); - self::assertEquals('/user/', $uri->getPath()); + self::assertSame('/user/', $uri->getPath()); self::assertStringNotContainsString('resource=', $uri->getQuery()); } diff --git a/tests/OptionTest.php b/tests/OptionTest.php index 81e62c8..1900e49 100644 --- a/tests/OptionTest.php +++ b/tests/OptionTest.php @@ -23,7 +23,7 @@ public function testDefaultHttpRequestTimeout(): void ->getLastOptions(); self::assertArrayHasKey('timeout', $options); - self::assertEquals(30, $options['timeout'], 'Default request timeout not set'); + self::assertSame(30, $options['timeout'], 'Default request timeout not set'); } public function testHttpRequestTimeoutOption(): void @@ -39,6 +39,6 @@ public function testHttpRequestTimeoutOption(): void $client->execute(['resource' => 'user', 'id' => 1337]); $options = $mockHandler->getLastOptions(); - self::assertEquals(5, $options['timeout'], 'Request timeout not set correctly'); + self::assertSame(5, $options['timeout'], 'Request timeout not set correctly'); } } diff --git a/tests/ParameterTest.php b/tests/ParameterTest.php index 973f9b1..5448676 100644 --- a/tests/ParameterTest.php +++ b/tests/ParameterTest.php @@ -30,7 +30,7 @@ public function setUp(): void public function testRequestParameter($name, $value, $encoded): void { $request = (new ApiRequestFactory($this->uri))->create(['resource' => 'user', $name => $value]); - self::assertEquals($name . '=' . $encoded, $request->getUri()->getQuery()); + self::assertSame("{$name}={$encoded}", $request->getUri()->getQuery()); } public static function parameters(): array @@ -64,8 +64,8 @@ public function testSendRandomDataAsJson(): void ] ]); - self::assertEquals(['application/json'], $request->getHeader('Content-Type')); - self::assertEquals('{"title":"Lorem Ipsum","author":{"id":1337}}', (string) $request->getBody()); + self::assertSame('application/json', $request->getHeaderLine('Content-Type')); + self::assertSame('{"title":"Lorem Ipsum","author":{"id":1337}}', (string) $request->getBody()); } public function testFormatParameter(): void @@ -77,7 +77,7 @@ public function testFormatParameter(): void 'format' => 'image' ]); - self::assertEquals('/user/1337.image', $request->getUri()->getPath()); + self::assertSame('/user/1337.image', $request->getUri()->getPath()); self::assertStringNotContainsString('format=', $request->getUri()->getQuery()); } @@ -102,7 +102,7 @@ public function testParameterOrder(): void 'filter' => 'address.country.iso2=AT' ]); - self::assertEquals($expectedQueryString, $request->getUri()->getQuery()); + self::assertSame($expectedQueryString, $request->getUri()->getQuery()); } public function testAuthorizeParameter(): void diff --git a/tests/RequestMethodTest.php b/tests/RequestMethodTest.php index 1e1ea7c..27b4dec 100644 --- a/tests/RequestMethodTest.php +++ b/tests/RequestMethodTest.php @@ -26,7 +26,7 @@ public function setUp(): void public function testHttpGetMethod(array $params, string $message): void { $request = (new ApiRequestFactory($this->uri))->create($params); - self::assertEquals('GET', $request->getMethod(), $message); + self::assertSame('GET', $request->getMethod(), $message); } public function testHttpPostMethodForNonRetrieveActions(): void @@ -34,8 +34,8 @@ public function testHttpPostMethodForNonRetrieveActions(): void $request = (new ApiRequestFactory($this->uri)) ->create(['resource' => 'user', 'id' => 1337, 'action' => 'foobar']); - self::assertEquals('POST', $request->getMethod()); - self::assertEquals('application/x-www-form-urlencoded', $request->getHeaderLine('Content-Type')); + self::assertSame('POST', $request->getMethod()); + self::assertSame('application/x-www-form-urlencoded', $request->getHeaderLine('Content-Type')); } public function testHttpMethodParameterOverwrite(): void @@ -43,7 +43,7 @@ public function testHttpMethodParameterOverwrite(): void $request = (new ApiRequestFactory($this->uri)) ->create(['resource' => 'user', 'id' => 1337, 'httpMethod' => 'POST']); - self::assertEquals('POST', $request->getMethod()); + self::assertSame('POST', $request->getMethod()); } public function testHttpPostMethodForLongQueryStrings(): void @@ -58,7 +58,7 @@ public function testHttpPostMethodForLongQueryStrings(): void 'page' => 10 ]); - self::assertEquals('POST', $request->getMethod()); + self::assertSame('POST', $request->getMethod()); self::assertStringContainsString( 'select=', (string) $request->getBody(), @@ -75,8 +75,8 @@ public function testHttpPostMethodForJsonData(): void 'data' => ['title' => 'Lorem Ipsum'] ]); - self::assertEquals('POST', $request->getMethod()); - self::assertEquals('action=create', $request->getUri()->getQuery()); + self::assertSame('POST', $request->getMethod()); + self::assertSame('action=create', $request->getUri()->getQuery()); } public static function defaultHttpMethodDataProvider(): array diff --git a/tests/SelectSerializationTest.php b/tests/SelectSerializationTest.php index 740c772..6058245 100644 --- a/tests/SelectSerializationTest.php +++ b/tests/SelectSerializationTest.php @@ -10,12 +10,12 @@ class SelectSerializationTest extends TestCase { public function testSimpleArray(): void { - self::assertEquals('id,name', stringify_select(['id', 'name'])); + self::assertSame('id,name', stringify_select(['id', 'name'])); } public function testNestedArrays(): void { - self::assertEquals('id,name,attr1,attr2', stringify_select(['id', 'name', ['attr1', 'attr2']])); + self::assertSame('id,name,attr1,attr2', stringify_select(['id', 'name', ['attr1', 'attr2']])); } public function testNestedArraysWithNonNumericKeys(): void @@ -27,12 +27,12 @@ public function testNestedArraysWithNonNumericKeys(): void 'attr' ]; - self::assertEquals('id,name,subGroup[attr1,attr2],attr', stringify_select($spec)); + self::assertSame('id,name,subGroup[attr1,attr2],attr', stringify_select($spec)); } public function testNonNumericKeysWithNonArrayValues(): void { - self::assertEquals('subGroup.attr', stringify_select(['subGroup' => 'attr'])); + self::assertSame('subGroup.attr', stringify_select(['subGroup' => 'attr'])); } public function testNestedNonNumericArrays(): void @@ -41,7 +41,7 @@ public function testNestedNonNumericArrays(): void 'subGroup' => ['subSubGroup' => 'attr'] ]; - self::assertEquals('subGroup.subSubGroup.attr', stringify_select($spec)); + self::assertSame('subGroup.subSubGroup.attr', stringify_select($spec)); } public function testDeeplyNestedArrays(): void @@ -62,12 +62,12 @@ public function testDeeplyNestedArrays(): void ]; $selectString = 'id,name,subGroupA[id,name,subSubGroupA[attr1,attr2],subSubGroupB[subSubSubGroupA[attr1,attr2],subSubSubItem,subSubSubGroupB[attr1,attr2]]]'; - self::assertEquals($selectString, stringify_select($spec)); + self::assertSame($selectString, stringify_select($spec)); } public function testSingleItemSubItemGroup(): void { - self::assertEquals('group.attr', stringify_select(['group' => ['attr']])); + self::assertSame('group.attr', stringify_select(['group' => ['attr']])); } public function testError(): void