From 1b236b7a28bf8b949282a1fea944074456774dc6 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Sat, 11 Jan 2025 09:38:32 +0900 Subject: [PATCH] wip --- tests/InvokerTest.php | 2 +- tests/Module/HalModuleTest.php | 2 +- tests/Module/ImportModuleTest.php | 4 ++-- tests/OptionsTest.php | 8 ++++---- tests/PrettyJsonRendererTest.php | 4 ++-- tests/Renderer/HalRendererTest.php | 10 +++++----- tests/ResourceTest.php | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/InvokerTest.php b/tests/InvokerTest.php index 35429b7d..97c98d69 100644 --- a/tests/InvokerTest.php +++ b/tests/InvokerTest.php @@ -167,7 +167,7 @@ public function testOptionsMethodBody(string $view): void "DELETE": [] } '; - $this->assertSame($expected, $view); + $this->assertJsonStringEqualsJsonString($expected, $view); } public function testOptionsMethod2(): void diff --git a/tests/Module/HalModuleTest.php b/tests/Module/HalModuleTest.php index 521ccddc..bc1998d7 100644 --- a/tests/Module/HalModuleTest.php +++ b/tests/Module/HalModuleTest.php @@ -43,6 +43,6 @@ public function testConfigure(): void } '; assert($news instanceof Request); - $this->assertSame($expect, (string) $news); + $this->assertJsonStringEqualsJsonString($expect, (string) $news); } } diff --git a/tests/Module/ImportModuleTest.php b/tests/Module/ImportModuleTest.php index 3a70ccbb..a08af323 100644 --- a/tests/Module/ImportModuleTest.php +++ b/tests/Module/ImportModuleTest.php @@ -63,7 +63,7 @@ public function testConfigure(): void } } '; - $this->assertSame($expect, (string) $news); + $this->assertJsonStringEqualsJsonString($expect, (string) $news); $news = $resource ->get @@ -83,6 +83,6 @@ public function testConfigure(): void } } '; - $this->assertSame($expect, (string) $news); + $this->assertJsonStringEqualsJsonString($expect, (string) $news); } } diff --git a/tests/OptionsTest.php b/tests/OptionsTest.php index 7b48ee75..a9205ea0 100644 --- a/tests/OptionsTest.php +++ b/tests/OptionsTest.php @@ -99,7 +99,7 @@ public function testOptionsMethodBody(ResourceObject $ro): void } } '; - $this->assertSame($expected, $actual); + $this->assertJsonStringEqualsJsonString($expected, $actual); } /** @return ResourceObject[][] */ @@ -197,7 +197,7 @@ public function testAssistedResource(ResourceObject $ro): void } } '; - $this->assertSame($expected, $actual); + $this->assertJsonStringEqualsJsonString($expected, $actual); } public function testOptionsMethodWithJsonSchema(): void @@ -244,7 +244,7 @@ public function testOptionsMethodWithJsonSchema(): void } } '; - $this->assertSame($expected, $actual); + $this->assertJsonStringEqualsJsonString($expected, $actual); } public function testOptionsNoSchemaFile(): void @@ -267,6 +267,6 @@ public function testOptionsNoSchemaFile(): void } } '; - $this->assertSame($expected, $ro->view); + $this->assertJsonStringEqualsJsonString($expected, $ro->view); } } diff --git a/tests/PrettyJsonRendererTest.php b/tests/PrettyJsonRendererTest.php index d60f7e7c..42e24f16 100644 --- a/tests/PrettyJsonRendererTest.php +++ b/tests/PrettyJsonRendererTest.php @@ -24,7 +24,7 @@ public function testRender(): void { $ro = new NullResourceObject(); $ro->body = ['a' => ['b' => 'c']]; - $this->assertSame('{ + $this->assertJsonStringEqualsJsonString('{ "a": { "b": "c" } @@ -37,7 +37,7 @@ public function testRenderWithEmbeded(): void $resource = (new Injector(new EmbedResourceModule(new ResourceModule('FakeVendor\Sandbox')), __DIR__ . '/tmp'))->getInstance(ResourceInterface::class); assert($resource instanceof ResourceInterface); $ro = $resource->get('app://self/bird/embed-birds', ['id' => '1']); - $this->assertSame('{ + $this->assertJsonStringEqualsJsonString('{ "birds": { "bird1": { "name": "chill kun" diff --git a/tests/Renderer/HalRendererTest.php b/tests/Renderer/HalRendererTest.php index f7acae59..90492719 100644 --- a/tests/Renderer/HalRendererTest.php +++ b/tests/Renderer/HalRendererTest.php @@ -50,7 +50,7 @@ public function testRender(): void } EOT; - $this->assertSame($expected, $data); + $this->assertJsonStringEqualsJsonString($expected, $data); } public function testRenderScalar(): void @@ -71,7 +71,7 @@ public function testRenderScalar(): void } EOT; - $this->assertSame($expected, $data); + $this->assertJsonStringEqualsJsonString($expected, $data); } public function testHeader(): void @@ -110,7 +110,7 @@ public function testBodyLink(): void } EOT; - $this->assertSame($expected, $actual); + $this->assertJsonStringEqualsJsonString($expected, $actual); } public function testLocationHeader(): void @@ -140,7 +140,7 @@ public function testNonArrayBody(): void } EOT; - $this->assertSame($expected, $actual); + $this->assertJsonStringEqualsJsonString($expected, $actual); } public function testRenderNullBody(): void @@ -160,7 +160,7 @@ public function testRenderNullBody(): void } EOT; - $this->assertSame($expected, $actual); + $this->assertJsonStringEqualsJsonString($expected, $actual); } public function testBodyObject(): void diff --git a/tests/ResourceTest.php b/tests/ResourceTest.php index e9a28e75..19a45b9a 100644 --- a/tests/ResourceTest.php +++ b/tests/ResourceTest.php @@ -222,7 +222,7 @@ public function testHal(): void } } '; - $this->assertSame($expected, (string) $user); + $this->assertJsonStringEqualsJsonString($expected, (string) $user); } public function testConstructorHasAnotherResourceRequest(): void @@ -314,7 +314,7 @@ public function testMultipleRequest(): void } } '; - $this->assertSame($expected, $view); + $this->assertJsonStringEqualsJsonString($expected, $view); } /** @covers \BEAR\Resource\Resource::options() */