From 93cb563fa5d6496694cc699b3fda880f93388754 Mon Sep 17 00:00:00 2001 From: Shift Date: Thu, 28 Mar 2024 10:30:54 +0000 Subject: [PATCH 01/10] Bump PHPUnit dependencies --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index ab9c42d..8812af0 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,14 @@ } ], "require": { - "php" : "^8.1", + "php": "^8.1", "ext-json": "*", "laravel/framework": "^10.0" }, "require-dev": { "laravel/pint": "^1.15", "orchestra/testbench": "^8.0", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "autoload": { "psr-4": { From 30e1ea56643600dcb755cd23f6b2c122ce33466e Mon Sep 17 00:00:00 2001 From: Shift Date: Thu, 28 Mar 2024 10:30:54 +0000 Subject: [PATCH 02/10] Ignore PHPUnit cache folder --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 22f3c3f..e9da540 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ composer.lock /vendor # Tooling -/.phpunit.result.cache +/.phpunit.cache From 305511f0b912e9b61e95aa2ebe9e34041394e334 Mon Sep 17 00:00:00 2001 From: Shift Date: Thu, 28 Mar 2024 10:30:54 +0000 Subject: [PATCH 03/10] Adopt PHP attributes in test classes --- tests/BuilderTest.php | 33 +++++++++---------------------- tests/ResponseFactoryTest.php | 37 ++++++++++------------------------- tests/ResponseMacroTest.php | 5 ++--- tests/ServiceProviderTest.php | 9 +++------ 4 files changed, 24 insertions(+), 60 deletions(-) diff --git a/tests/BuilderTest.php b/tests/BuilderTest.php index d365ceb..1eed942 100644 --- a/tests/BuilderTest.php +++ b/tests/BuilderTest.php @@ -2,6 +2,7 @@ namespace Swis\Laravel\JavaScriptData; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Swis\Laravel\JavaScriptData\Stub\ArrayableStub; use Swis\Laravel\JavaScriptData\Stub\JsonableStub; @@ -9,9 +10,7 @@ class BuilderTest extends TestCase { - /** - * @test - */ + #[Test] public function itBuilds() { $builder = new Builder(); @@ -23,9 +22,7 @@ public function itBuilds() ); } - /** - * @test - */ + #[Test] public function itBuildsANestedNamespace() { $builder = new Builder(); @@ -37,9 +34,7 @@ public function itBuildsANestedNamespace() ); } - /** - * @test - */ + #[Test] public function itBuildsWithExtraJsonEncodeOptions() { $builder = new Builder(); @@ -51,9 +46,7 @@ public function itBuildsWithExtraJsonEncodeOptions() ); } - /** - * @test - */ + #[Test] public function itBuildsPrettyPrinted() { $builder = new Builder(); @@ -70,9 +63,7 @@ public function itBuildsPrettyPrinted() ); } - /** - * @test - */ + #[Test] public function itBuildsWithArrayableData() { $builder = new Builder(); @@ -84,9 +75,7 @@ public function itBuildsWithArrayableData() ); } - /** - * @test - */ + #[Test] public function itBuildsWithJsonableData() { $builder = new Builder(); @@ -98,9 +87,7 @@ public function itBuildsWithJsonableData() ); } - /** - * @test - */ + #[Test] public function itBuildsWithJsonSerializableData() { $builder = new Builder(); @@ -112,9 +99,7 @@ public function itBuildsWithJsonSerializableData() ); } - /** - * @test - */ + #[Test] public function itThrowsWhenJsonEncodeFailed() { $this->expectExceptionObject(new \InvalidArgumentException('Malformed UTF-8 characters, possibly incorrectly encoded', 5)); diff --git a/tests/ResponseFactoryTest.php b/tests/ResponseFactoryTest.php index d375096..62fda3f 100644 --- a/tests/ResponseFactoryTest.php +++ b/tests/ResponseFactoryTest.php @@ -2,14 +2,13 @@ namespace Swis\Laravel\JavaScriptData; +use PHPUnit\Framework\Attributes\Test; use Illuminate\Routing\ResponseFactory as IlluminateResponseFactory; use Orchestra\Testbench\TestCase; class ResponseFactoryTest extends TestCase { - /** - * @test - */ + #[Test] public function itMakesAResponse() { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ @@ -30,9 +29,7 @@ public function itMakesAResponse() $this->assertSame('foo bar', $response->getContent()); } - /** - * @test - */ + #[Test] public function itMakesAResponseWithDefaultNamespace() { $this->app['config']->set('javascript-data-response.namespace', 'foo.bar'); @@ -52,9 +49,7 @@ public function itMakesAResponseWithDefaultNamespace() $factory->make('namespace'); } - /** - * @test - */ + #[Test] public function itMakesAResponseWithPrettyPrintOption() { $this->app['config']->set('javascript-data-response.pretty-print', true); @@ -74,9 +69,7 @@ public function itMakesAResponseWithPrettyPrintOption() $factory->make('namespace'); } - /** - * @test - */ + #[Test] public function itMakesAResponseWithDefaultStatus() { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ @@ -92,9 +85,7 @@ public function itMakesAResponseWithDefaultStatus() $this->assertSame(200, $response->getStatusCode()); } - /** - * @test - */ + #[Test] public function itMakesAResponseWithCustomStatus() { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ @@ -110,9 +101,7 @@ public function itMakesAResponseWithCustomStatus() $this->assertSame(500, $response->getStatusCode()); } - /** - * @test - */ + #[Test] public function itMakesAResponseWithDefaultHeaders() { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ @@ -146,9 +135,7 @@ public function itMakesAResponseWithDefaultHeaders() $this->assertSame('application/javascript; charset=utf-8', $response->headers->get('content-type')); } - /** - * @test - */ + #[Test] public function itMakesAResponseWithCustomHeaders() { $this->app['config']->set( @@ -170,9 +157,7 @@ public function itMakesAResponseWithCustomHeaders() $this->assertSame('Bar', $response->headers->get('x-foo')); } - /** - * @test - */ + #[Test] public function itMakesAResponseWithDefaultOptions() { $this->app['config']->set('javascript-data-response.json_encode-options', JSON_UNESCAPED_UNICODE); @@ -192,9 +177,7 @@ public function itMakesAResponseWithDefaultOptions() $factory->make('namespace'); } - /** - * @test - */ + #[Test] public function itMakesAResponseWithCustomOptions() { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ diff --git a/tests/ResponseMacroTest.php b/tests/ResponseMacroTest.php index 49c59a9..d63e545 100644 --- a/tests/ResponseMacroTest.php +++ b/tests/ResponseMacroTest.php @@ -2,6 +2,7 @@ namespace Swis\Laravel\JavaScriptData; +use PHPUnit\Framework\Attributes\Test; use Illuminate\Support\Facades\Response; use Orchestra\Testbench\TestCase; @@ -17,9 +18,7 @@ protected function getEnvironmentSetUp($app) $app['config']->set('javascript-data-response.pretty-print', false); } - /** - * @test - */ + #[Test] public function itMakesAResponse() { /** @var \Illuminate\Http\Response $response */ diff --git a/tests/ServiceProviderTest.php b/tests/ServiceProviderTest.php index ce10555..f4cf9a7 100644 --- a/tests/ServiceProviderTest.php +++ b/tests/ServiceProviderTest.php @@ -2,6 +2,7 @@ namespace Swis\Laravel\JavaScriptData; +use PHPUnit\Framework\Attributes\Test; use Illuminate\Routing\ResponseFactory; use Orchestra\Testbench\TestCase; @@ -12,9 +13,7 @@ protected function getPackageProviders($app) return [ServiceProvider::class]; } - /** - * @test - */ + #[Test] public function itMergesTheConfig() { $this->assertSame( @@ -30,9 +29,7 @@ public function itMergesTheConfig() ); } - /** - * @test - */ + #[Test] public function itRegistersAResponseMacro() { $this->assertTrue(ResponseFactory::hasMacro('javascriptData')); From f2e5cf89c8ce1ce62dd815c8f37d8b8c5380198a Mon Sep 17 00:00:00 2001 From: Shift Date: Thu, 28 Mar 2024 10:30:54 +0000 Subject: [PATCH 04/10] Add return types to test methods --- tests/BuilderTest.php | 16 ++++++++-------- tests/ResponseFactoryTest.php | 18 +++++++++--------- tests/ResponseMacroTest.php | 2 +- tests/ServiceProviderTest.php | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/BuilderTest.php b/tests/BuilderTest.php index 1eed942..b9d9fda 100644 --- a/tests/BuilderTest.php +++ b/tests/BuilderTest.php @@ -11,7 +11,7 @@ class BuilderTest extends TestCase { #[Test] - public function itBuilds() + public function itBuilds(): void { $builder = new Builder(); $javascript = $builder->build('namespace', ['foo' => 'bar']); @@ -23,7 +23,7 @@ public function itBuilds() } #[Test] - public function itBuildsANestedNamespace() + public function itBuildsANestedNamespace(): void { $builder = new Builder(); $javascript = $builder->build('name.space.string', ['foo' => 'bar']); @@ -35,7 +35,7 @@ public function itBuildsANestedNamespace() } #[Test] - public function itBuildsWithExtraJsonEncodeOptions() + public function itBuildsWithExtraJsonEncodeOptions(): void { $builder = new Builder(); $javascript = $builder->build('namespace', ['test' => 'tést/tëst', 'foo' => []], JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE); @@ -47,7 +47,7 @@ public function itBuildsWithExtraJsonEncodeOptions() } #[Test] - public function itBuildsPrettyPrinted() + public function itBuildsPrettyPrinted(): void { $builder = new Builder(); $javascript = $builder->build('name.space', ['foo' => 'bar'], JSON_PRETTY_PRINT); @@ -64,7 +64,7 @@ public function itBuildsPrettyPrinted() } #[Test] - public function itBuildsWithArrayableData() + public function itBuildsWithArrayableData(): void { $builder = new Builder(); $javascript = $builder->build('namespace', new ArrayableStub()); @@ -76,7 +76,7 @@ public function itBuildsWithArrayableData() } #[Test] - public function itBuildsWithJsonableData() + public function itBuildsWithJsonableData(): void { $builder = new Builder(); $javascript = $builder->build('namespace', new JsonableStub()); @@ -88,7 +88,7 @@ public function itBuildsWithJsonableData() } #[Test] - public function itBuildsWithJsonSerializableData() + public function itBuildsWithJsonSerializableData(): void { $builder = new Builder(); $javascript = $builder->build('namespace', new JsonSerializableStub()); @@ -100,7 +100,7 @@ public function itBuildsWithJsonSerializableData() } #[Test] - public function itThrowsWhenJsonEncodeFailed() + public function itThrowsWhenJsonEncodeFailed(): void { $this->expectExceptionObject(new \InvalidArgumentException('Malformed UTF-8 characters, possibly incorrectly encoded', 5)); diff --git a/tests/ResponseFactoryTest.php b/tests/ResponseFactoryTest.php index 62fda3f..840a88e 100644 --- a/tests/ResponseFactoryTest.php +++ b/tests/ResponseFactoryTest.php @@ -9,7 +9,7 @@ class ResponseFactoryTest extends TestCase { #[Test] - public function itMakesAResponse() + public function itMakesAResponse(): void { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ $responseFactory = $this->app->make(IlluminateResponseFactory::class); @@ -30,7 +30,7 @@ public function itMakesAResponse() } #[Test] - public function itMakesAResponseWithDefaultNamespace() + public function itMakesAResponseWithDefaultNamespace(): void { $this->app['config']->set('javascript-data-response.namespace', 'foo.bar'); @@ -50,7 +50,7 @@ public function itMakesAResponseWithDefaultNamespace() } #[Test] - public function itMakesAResponseWithPrettyPrintOption() + public function itMakesAResponseWithPrettyPrintOption(): void { $this->app['config']->set('javascript-data-response.pretty-print', true); @@ -70,7 +70,7 @@ public function itMakesAResponseWithPrettyPrintOption() } #[Test] - public function itMakesAResponseWithDefaultStatus() + public function itMakesAResponseWithDefaultStatus(): void { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ $responseFactory = $this->app->make(IlluminateResponseFactory::class); @@ -86,7 +86,7 @@ public function itMakesAResponseWithDefaultStatus() } #[Test] - public function itMakesAResponseWithCustomStatus() + public function itMakesAResponseWithCustomStatus(): void { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ $responseFactory = $this->app->make(IlluminateResponseFactory::class); @@ -102,7 +102,7 @@ public function itMakesAResponseWithCustomStatus() } #[Test] - public function itMakesAResponseWithDefaultHeaders() + public function itMakesAResponseWithDefaultHeaders(): void { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ $responseFactory = $this->app->make(IlluminateResponseFactory::class); @@ -136,7 +136,7 @@ public function itMakesAResponseWithDefaultHeaders() } #[Test] - public function itMakesAResponseWithCustomHeaders() + public function itMakesAResponseWithCustomHeaders(): void { $this->app['config']->set( 'javascript-data-response.headers', @@ -158,7 +158,7 @@ public function itMakesAResponseWithCustomHeaders() } #[Test] - public function itMakesAResponseWithDefaultOptions() + public function itMakesAResponseWithDefaultOptions(): void { $this->app['config']->set('javascript-data-response.json_encode-options', JSON_UNESCAPED_UNICODE); @@ -178,7 +178,7 @@ public function itMakesAResponseWithDefaultOptions() } #[Test] - public function itMakesAResponseWithCustomOptions() + public function itMakesAResponseWithCustomOptions(): void { /** @var \Illuminate\Routing\ResponseFactory $responseFactory */ $responseFactory = $this->app->make(IlluminateResponseFactory::class); diff --git a/tests/ResponseMacroTest.php b/tests/ResponseMacroTest.php index d63e545..1859f80 100644 --- a/tests/ResponseMacroTest.php +++ b/tests/ResponseMacroTest.php @@ -19,7 +19,7 @@ protected function getEnvironmentSetUp($app) } #[Test] - public function itMakesAResponse() + public function itMakesAResponse(): void { /** @var \Illuminate\Http\Response $response */ $response = Response::javascriptData('namespace', ['foo' => 'bar']); diff --git a/tests/ServiceProviderTest.php b/tests/ServiceProviderTest.php index f4cf9a7..a0b1287 100644 --- a/tests/ServiceProviderTest.php +++ b/tests/ServiceProviderTest.php @@ -14,7 +14,7 @@ protected function getPackageProviders($app) } #[Test] - public function itMergesTheConfig() + public function itMergesTheConfig(): void { $this->assertSame( [ @@ -30,7 +30,7 @@ public function itMergesTheConfig() } #[Test] - public function itRegistersAResponseMacro() + public function itRegistersAResponseMacro(): void { $this->assertTrue(ResponseFactory::hasMacro('javascriptData')); } From e7505db2ffb1802fa0049a9b6d4f34d67a764e1b Mon Sep 17 00:00:00 2001 From: Shift Date: Thu, 28 Mar 2024 10:30:54 +0000 Subject: [PATCH 05/10] Define test classes as `final` --- tests/BuilderTest.php | 2 +- tests/ResponseFactoryTest.php | 2 +- tests/ResponseMacroTest.php | 2 +- tests/ServiceProviderTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/BuilderTest.php b/tests/BuilderTest.php index b9d9fda..853ddd7 100644 --- a/tests/BuilderTest.php +++ b/tests/BuilderTest.php @@ -8,7 +8,7 @@ use Swis\Laravel\JavaScriptData\Stub\JsonableStub; use Swis\Laravel\JavaScriptData\Stub\JsonSerializableStub; -class BuilderTest extends TestCase +final class BuilderTest extends TestCase { #[Test] public function itBuilds(): void diff --git a/tests/ResponseFactoryTest.php b/tests/ResponseFactoryTest.php index 840a88e..06f6e8f 100644 --- a/tests/ResponseFactoryTest.php +++ b/tests/ResponseFactoryTest.php @@ -6,7 +6,7 @@ use Illuminate\Routing\ResponseFactory as IlluminateResponseFactory; use Orchestra\Testbench\TestCase; -class ResponseFactoryTest extends TestCase +final class ResponseFactoryTest extends TestCase { #[Test] public function itMakesAResponse(): void diff --git a/tests/ResponseMacroTest.php b/tests/ResponseMacroTest.php index 1859f80..9aa9716 100644 --- a/tests/ResponseMacroTest.php +++ b/tests/ResponseMacroTest.php @@ -6,7 +6,7 @@ use Illuminate\Support\Facades\Response; use Orchestra\Testbench\TestCase; -class ResponseMacroTest extends TestCase +final class ResponseMacroTest extends TestCase { protected function getPackageProviders($app) { diff --git a/tests/ServiceProviderTest.php b/tests/ServiceProviderTest.php index a0b1287..7048ee0 100644 --- a/tests/ServiceProviderTest.php +++ b/tests/ServiceProviderTest.php @@ -6,7 +6,7 @@ use Illuminate\Routing\ResponseFactory; use Orchestra\Testbench\TestCase; -class ServiceProviderTest extends TestCase +final class ServiceProviderTest extends TestCase { protected function getPackageProviders($app) { From b50c65d5817b3bd38010c99f8834725fcc59a8af Mon Sep 17 00:00:00 2001 From: Jasper Zonneveld Date: Thu, 28 Mar 2024 11:35:25 +0100 Subject: [PATCH 06/10] build: update PHPUnit config --- phpunit.xml.dist | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f869f5d..546e8de 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,21 @@ - + stopOnFailure="false" + cacheDirectory=".phpunit.cache"> ./tests - - + + ./src - - + + From 5a2f9089e34d597c347da165c247a570f47ab561 Mon Sep 17 00:00:00 2001 From: Jasper Zonneveld Date: Thu, 28 Mar 2024 11:37:31 +0100 Subject: [PATCH 07/10] refactor: use onlyMethods instead of setMethods --- tests/ResponseFactoryTest.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/ResponseFactoryTest.php b/tests/ResponseFactoryTest.php index 06f6e8f..d5c33fc 100644 --- a/tests/ResponseFactoryTest.php +++ b/tests/ResponseFactoryTest.php @@ -15,7 +15,7 @@ public function itMakesAResponse(): void $responseFactory = $this->app->make(IlluminateResponseFactory::class); /** @var \PHPUnit\Framework\MockObject\MockObject|\Swis\Laravel\JavaScriptData\Builder $builder */ $builder = $this->getMockBuilder(Builder::class) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); $builder ->expects($this->once()) @@ -38,7 +38,7 @@ public function itMakesAResponseWithDefaultNamespace(): void $responseFactory = $this->app->make(IlluminateResponseFactory::class); /** @var \PHPUnit\Framework\MockObject\MockObject|\Swis\Laravel\JavaScriptData\Builder $builder */ $builder = $this->getMockBuilder(Builder::class) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); $builder ->expects($this->once()) @@ -58,7 +58,7 @@ public function itMakesAResponseWithPrettyPrintOption(): void $responseFactory = $this->app->make(IlluminateResponseFactory::class); /** @var \PHPUnit\Framework\MockObject\MockObject|\Swis\Laravel\JavaScriptData\Builder $builder */ $builder = $this->getMockBuilder(Builder::class) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); $builder ->expects($this->once()) @@ -76,7 +76,7 @@ public function itMakesAResponseWithDefaultStatus(): void $responseFactory = $this->app->make(IlluminateResponseFactory::class); /** @var \PHPUnit\Framework\MockObject\MockObject|\Swis\Laravel\JavaScriptData\Builder $builder */ $builder = $this->getMockBuilder(Builder::class) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); $factory = new ResponseFactory($responseFactory, $builder); @@ -92,7 +92,7 @@ public function itMakesAResponseWithCustomStatus(): void $responseFactory = $this->app->make(IlluminateResponseFactory::class); /** @var \PHPUnit\Framework\MockObject\MockObject|\Swis\Laravel\JavaScriptData\Builder $builder */ $builder = $this->getMockBuilder(Builder::class) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); $factory = new ResponseFactory($responseFactory, $builder); @@ -108,7 +108,7 @@ public function itMakesAResponseWithDefaultHeaders(): void $responseFactory = $this->app->make(IlluminateResponseFactory::class); /** @var \PHPUnit\Framework\MockObject\MockObject|\Swis\Laravel\JavaScriptData\Builder $builder */ $builder = $this->getMockBuilder(Builder::class) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); $factory = new ResponseFactory($responseFactory, $builder); @@ -147,7 +147,7 @@ public function itMakesAResponseWithCustomHeaders(): void $responseFactory = $this->app->make(IlluminateResponseFactory::class); /** @var \PHPUnit\Framework\MockObject\MockObject|\Swis\Laravel\JavaScriptData\Builder $builder */ $builder = $this->getMockBuilder(Builder::class) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); $factory = new ResponseFactory($responseFactory, $builder); @@ -166,7 +166,7 @@ public function itMakesAResponseWithDefaultOptions(): void $responseFactory = $this->app->make(IlluminateResponseFactory::class); /** @var \PHPUnit\Framework\MockObject\MockObject|\Swis\Laravel\JavaScriptData\Builder $builder */ $builder = $this->getMockBuilder(Builder::class) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); $builder ->expects($this->once()) @@ -184,7 +184,7 @@ public function itMakesAResponseWithCustomOptions(): void $responseFactory = $this->app->make(IlluminateResponseFactory::class); /** @var \PHPUnit\Framework\MockObject\MockObject|\Swis\Laravel\JavaScriptData\Builder $builder */ $builder = $this->getMockBuilder(Builder::class) - ->setMethods(['build']) + ->onlyMethods(['build']) ->getMock(); $builder ->expects($this->once()) From 3cac7fa0c6b5fe5bedf2e03c689c4f687f6631a1 Mon Sep 17 00:00:00 2001 From: Jasper Zonneveld Date: Thu, 28 Mar 2024 11:38:18 +0100 Subject: [PATCH 08/10] style: fix code style --- tests/ResponseFactoryTest.php | 2 +- tests/ResponseMacroTest.php | 2 +- tests/ServiceProviderTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/ResponseFactoryTest.php b/tests/ResponseFactoryTest.php index d5c33fc..e353ad8 100644 --- a/tests/ResponseFactoryTest.php +++ b/tests/ResponseFactoryTest.php @@ -2,9 +2,9 @@ namespace Swis\Laravel\JavaScriptData; -use PHPUnit\Framework\Attributes\Test; use Illuminate\Routing\ResponseFactory as IlluminateResponseFactory; use Orchestra\Testbench\TestCase; +use PHPUnit\Framework\Attributes\Test; final class ResponseFactoryTest extends TestCase { diff --git a/tests/ResponseMacroTest.php b/tests/ResponseMacroTest.php index 9aa9716..c554c58 100644 --- a/tests/ResponseMacroTest.php +++ b/tests/ResponseMacroTest.php @@ -2,9 +2,9 @@ namespace Swis\Laravel\JavaScriptData; -use PHPUnit\Framework\Attributes\Test; use Illuminate\Support\Facades\Response; use Orchestra\Testbench\TestCase; +use PHPUnit\Framework\Attributes\Test; final class ResponseMacroTest extends TestCase { diff --git a/tests/ServiceProviderTest.php b/tests/ServiceProviderTest.php index 7048ee0..4c8f939 100644 --- a/tests/ServiceProviderTest.php +++ b/tests/ServiceProviderTest.php @@ -2,9 +2,9 @@ namespace Swis\Laravel\JavaScriptData; -use PHPUnit\Framework\Attributes\Test; use Illuminate\Routing\ResponseFactory; use Orchestra\Testbench\TestCase; +use PHPUnit\Framework\Attributes\Test; final class ServiceProviderTest extends TestCase { From 6a2844cfef80c5cf80b8d8cfdf7d1d201b22cad3 Mon Sep 17 00:00:00 2001 From: Jasper Zonneveld Date: Thu, 28 Mar 2024 11:41:10 +0100 Subject: [PATCH 09/10] build: make PHPUnit more verbose --- phpunit.xml.dist | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 546e8de..3b92943 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,6 +5,10 @@ backupGlobals="false" backupStaticProperties="false" colors="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" processIsolation="false" stopOnFailure="false" cacheDirectory=".phpunit.cache"> From fe589d243768f21600f4b13377e02877eaafa99b Mon Sep 17 00:00:00 2001 From: Jasper Zonneveld Date: Thu, 28 Mar 2024 11:43:04 +0100 Subject: [PATCH 10/10] test: fix return type in JsonSerializableStub --- stubs/JsonSerializableStub.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/JsonSerializableStub.php b/stubs/JsonSerializableStub.php index 04a6ffe..4b0acb7 100644 --- a/stubs/JsonSerializableStub.php +++ b/stubs/JsonSerializableStub.php @@ -16,7 +16,7 @@ class JsonSerializableStub implements \JsonSerializable * * @since 5.4.0 */ - public function jsonSerialize() + public function jsonSerialize(): array { return ['foo' => 'bar']; }