From 1d2203ca83235d353351e779820e047355c2f04a Mon Sep 17 00:00:00 2001 From: Duilio Palacios Date: Mon, 6 May 2024 17:10:33 +0100 Subject: [PATCH] Rector changes --- composer.json | 3 ++- composer.lock | 2 +- rector.php | 19 ++++++++++++++++ src/Console/DocumentationExporter.php | 2 +- src/Drivers/BaseExampleBuilder.php | 2 +- src/Drivers/DatabaseExampleBuilder.php | 14 ++++++------ src/Enlighten.php | 4 ++-- src/ExampleCreator.php | 2 +- src/HttpExamples/HttpExampleCreator.php | 4 ++-- src/Providers/EnlightenServiceProvider.php | 2 +- src/Tests/ExceptionRecorder.php | 8 +++---- src/Utils/Annotations.php | 2 +- tests/Console/DocumentationExporterTest.php | 12 +++++----- .../ExportDocumentationCommandTest.php | 6 ++--- .../App/Providers/RouteServiceProvider.php | 2 +- tests/Integration/CaptureCodeExampleTest.php | 22 +++++++++---------- tests/Integration/CaptureQueriesTest.php | 4 ++-- .../2014_10_12_000000_create_users_table.php | 4 ++-- ...oesntSaveIrrelevantRouteParametersTest.php | 2 +- tests/Integration/FailedRequestTest.php | 8 +++---- tests/Integration/FollowRedirectionTest.php | 2 +- .../IgnoreClassViaConfigurationTest.php | 2 +- .../IgnoreClassWithAnnotationTest.php | 2 +- tests/Integration/IgnoreMethodsTest.php | 8 +++---- .../IncludeClassWithAnnotationTest.php | 2 +- .../IncludeMethodWithAnnotationTest.php | 4 ++-- tests/Integration/ListUsersTest.php | 2 +- tests/Integration/MultipleRequestsTest.php | 2 +- tests/Integration/PostRequestTest.php | 4 ++-- tests/Integration/RouteNotFoundTest.php | 2 +- .../Integration/SavesOrderAnnotationTest.php | 2 +- tests/Integration/StringResponseTest.php | 4 ++-- tests/Integration/UploadFileTest.php | 2 +- .../WorksWithDataProvidersTest.php | 10 ++++----- tests/TestHelpers.php | 2 +- tests/Unit/AnnotationsTest.php | 8 +++---- tests/Unit/ChecksLaravelPresenceTest.php | 6 ++--- tests/Unit/DatabaseRunBuilderTest.php | 4 ++-- tests/Unit/DisableEnlightenTest.php | 2 +- tests/Unit/ExampleGeneratorTest.php | 2 +- tests/Unit/ExportCodeResultTest.php | 16 +++++++------- tests/Unit/GeneratesSlugFromClassNameTest.php | 4 ++-- .../Unit/GeneratesSlugFromMethodNameTest.php | 4 ++-- .../Unit/GeneratesTitleFromClassNameTest.php | 4 ++-- .../Unit/GeneratesTitleFromMethodNameTest.php | 8 +++---- tests/Unit/GetsAreaSlugTest.php | 4 ++-- tests/Unit/GuessDatabaseNameTest.php | 2 +- tests/Unit/HidesSectionsTest.php | 2 +- tests/Unit/Models/AreaTest.php | 6 ++--- tests/Unit/Models/EndpointTest.php | 2 +- tests/Unit/Models/ExampleGroupTest.php | 4 ++-- tests/Unit/Models/ExampleRequestTest.php | 12 +++++----- tests/Unit/Models/ExampleTest.php | 6 ++--- tests/Unit/Models/HideRequestHeadersTest.php | 6 ++--- tests/Unit/Models/HideRequestInputTest.php | 2 +- .../Models/HideRequestQueryParametersTest.php | 2 +- tests/Unit/Models/HideResponseDataTest.php | 4 ++-- tests/Unit/Models/HideSessionDataTest.php | 2 +- tests/Unit/Models/ModuleCollectionTest.php | 10 ++++----- tests/Unit/Models/RunTest.php | 12 +++++----- tests/Unit/Models/StatusTest.php | 2 +- tests/Unit/MultilanguageTest.php | 4 ++-- tests/Unit/RequestInspectorTest.php | 2 +- 63 files changed, 168 insertions(+), 148 deletions(-) create mode 100644 rector.php diff --git a/composer.json b/composer.json index cbd95ff..06ded48 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "require-dev": { "phpunit/phpunit": "^11.0.1", "orchestra/testbench": "^9.0", - "friendsofphp/php-cs-fixer": "^3.55" + "friendsofphp/php-cs-fixer": "^3.55", + "rector/rector": "^1.0" }, "license": "MIT", "authors": [ diff --git a/composer.lock b/composer.lock index e2a3d8c..704cf66 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ea8768a641c9075dd2784436d80f0484", + "content-hash": "d3f853fcb9b25c86716b4c0ca69b3157", "packages": [ { "name": "brick/math", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..1fa5425 --- /dev/null +++ b/rector.php @@ -0,0 +1,19 @@ +withPaths([ + __DIR__ . '/config', + __DIR__ . '/resources', + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + // uncomment to reach your current PHP version + // ->withPhpSets() + ->withRules([ + AddVoidReturnTypeWhereNoReturnRector::class, + ]); diff --git a/src/Console/DocumentationExporter.php b/src/Console/DocumentationExporter.php index a91649c..29d5d49 100644 --- a/src/Console/DocumentationExporter.php +++ b/src/Console/DocumentationExporter.php @@ -41,7 +41,7 @@ public function export(Run $run, string $baseDir, string $staticBaseUrl): void $this->exportSearchJson($run); } - private function exportAssets() + private function exportAssets(): void { $this->filesystem->deleteDirectory("{$this->baseDir}/assets"); diff --git a/src/Drivers/BaseExampleBuilder.php b/src/Drivers/BaseExampleBuilder.php index 3a07075..df1e5fb 100644 --- a/src/Drivers/BaseExampleBuilder.php +++ b/src/Drivers/BaseExampleBuilder.php @@ -105,7 +105,7 @@ public function setSlug(string $slug): ExampleBuilder return $this; } - public function setStatus(string $testStatus, string $status) + public function setStatus(string $testStatus, string $status): void { $this->testStatus = $testStatus; $this->status = $status; diff --git a/src/Drivers/DatabaseExampleBuilder.php b/src/Drivers/DatabaseExampleBuilder.php index edeef5b..be3e4ce 100644 --- a/src/Drivers/DatabaseExampleBuilder.php +++ b/src/Drivers/DatabaseExampleBuilder.php @@ -40,7 +40,7 @@ public function __construct(DatabaseExampleGroupBuilder $exampleGroupBuilder) $this->exampleGroupBuilder = $exampleGroupBuilder; } - public function addRequest(RequestInfo $request) + public function addRequest(RequestInfo $request): void { $this->save(); @@ -55,7 +55,7 @@ public function addRequest(RequestInfo $request) ])); } - public function setResponse(ResponseInfo $response, bool $followsRedirect, RouteInfo $routeInfo, array $session) + public function setResponse(ResponseInfo $response, bool $followsRedirect, RouteInfo $routeInfo, array $session): void { $this->save(); @@ -74,7 +74,7 @@ public function setResponse(ResponseInfo $response, bool $followsRedirect, Route ]); } - public function setException(ExceptionInfo $exception) + public function setException(ExceptionInfo $exception): void { $this->example->exception->fill([ 'class_name' => $exception->getClassName(), @@ -87,7 +87,7 @@ public function setException(ExceptionInfo $exception) ])->save(); } - public function addQuery(QueryExecuted $queryExecuted) + public function addQuery(QueryExecuted $queryExecuted): void { $this->save(); @@ -100,7 +100,7 @@ public function addQuery(QueryExecuted $queryExecuted) ]); } - public function addSnippet($key, string $code) + public function addSnippet($key, string $code): void { $this->save(); @@ -110,7 +110,7 @@ public function addSnippet($key, string $code) ]); } - public function setSnippetResult($result) + public function setSnippetResult($result): void { $this->currentSnippet->update(['result' => $result]); @@ -129,7 +129,7 @@ public function build(): ExampleContract return $this->example; } - private function save() + private function save(): void { if ($this->example != null) { return; diff --git a/src/Enlighten.php b/src/Enlighten.php index dc08c7d..43763cb 100644 --- a/src/Enlighten.php +++ b/src/Enlighten.php @@ -11,12 +11,12 @@ class Enlighten { private static $isDocumenting = false; - public static function document() + public static function document(): void { static::$isDocumenting = true; } - public static function stopDocumenting() + public static function stopDocumenting(): void { static::$isDocumenting = true; } diff --git a/src/ExampleCreator.php b/src/ExampleCreator.php index 9b8a8f4..e7d249b 100644 --- a/src/ExampleCreator.php +++ b/src/ExampleCreator.php @@ -43,7 +43,7 @@ public function getCurrentExample(): ?ExampleBuilder return $this->currentExampleBuilder; } - public function makeExample(string $className, string $methodName, array $providedData = null, $dataName = null) + public function makeExample(string $className, string $methodName, array $providedData = null, $dataName = null): void { $this->currentExampleBuilder = null; $this->currentException = null; diff --git a/src/HttpExamples/HttpExampleCreator.php b/src/HttpExamples/HttpExampleCreator.php index c1fec9a..a9ec9ab 100644 --- a/src/HttpExamples/HttpExampleCreator.php +++ b/src/HttpExamples/HttpExampleCreator.php @@ -65,7 +65,7 @@ public static function followingRedirect(Closure $callback) return $response; } - public function createHttpExample(Request $request) + public function createHttpExample(Request $request): void { $testExample = $this->exampleCreator->getCurrentExample(); @@ -78,7 +78,7 @@ public function createHttpExample(Request $request) ); } - public function saveHttpResponseData(Request $request, Response $response) + public function saveHttpResponseData(Request $request, Response $response): void { $testExample = $this->exampleCreator->getCurrentExample(); diff --git a/src/Providers/EnlightenServiceProvider.php b/src/Providers/EnlightenServiceProvider.php index 7ac3aa2..1b1c32d 100644 --- a/src/Providers/EnlightenServiceProvider.php +++ b/src/Providers/EnlightenServiceProvider.php @@ -27,7 +27,7 @@ class EnlightenServiceProvider extends ServiceProvider { use RegistersConsoleConfiguration, RegistersViewComponents, RegistersDatabaseConnection; - public function boot() + public function boot(): void { if ($this->app->environment('production') && ! $this->app->runningInConsole()) { return; diff --git a/src/Tests/ExceptionRecorder.php b/src/Tests/ExceptionRecorder.php index 9545c5e..eb5606d 100644 --- a/src/Tests/ExceptionRecorder.php +++ b/src/Tests/ExceptionRecorder.php @@ -27,19 +27,19 @@ public function __construct(ExceptionHandler $originalHandler) $this->originalHandler = $originalHandler; } - public function forwardToORiginal() + public function forwardToORiginal(): void { $this->forwardToOriginalHandler = true; $this->except = []; } - public function forceThrow(array $except = []) + public function forceThrow(array $except = []): void { $this->forwardToOriginalHandler = false; $this->except = $except; } - public function report(Throwable $e) + public function report(Throwable $e): void { app(ExampleCreator::class)->captureException($e); @@ -80,7 +80,7 @@ public function render($request, Throwable $e) throw $e; } - public function renderForConsole($output, Throwable $e) + public function renderForConsole($output, Throwable $e): void { if ($this->forwardToOriginalHandler) { $this->originalHandler->renderForConsole($output, $e); diff --git a/src/Utils/Annotations.php b/src/Utils/Annotations.php index 034e125..519e768 100644 --- a/src/Utils/Annotations.php +++ b/src/Utils/Annotations.php @@ -11,7 +11,7 @@ class Annotations { protected $casts = []; - public function addCast(string $key, Closure $callback) + public function addCast(string $key, Closure $callback): void { $this->casts[$key] = $callback; } diff --git a/tests/Console/DocumentationExporterTest.php b/tests/Console/DocumentationExporterTest.php index c0c9f13..5b41a55 100644 --- a/tests/Console/DocumentationExporterTest.php +++ b/tests/Console/DocumentationExporterTest.php @@ -41,7 +41,7 @@ protected function setUp(): void } #[Test] - function exports_run_as_static_files() + function exports_run_as_static_files(): void { $run = $this->createRun('main', 'abcde', true); $group1 = $this->createExampleGroup($run, 'Tests\Feature\ListUsersTest', 'List Users'); @@ -103,7 +103,7 @@ function exports_run_as_static_files() } #[Test] - function replaces_the_original_urls_with_relative_urls() + function replaces_the_original_urls_with_relative_urls(): void { $run = $this->createRun('main', 'abcde', true); @@ -131,7 +131,7 @@ function replaces_the_original_urls_with_relative_urls() } #[Test] - function replaces_the_original_urls_with_absolute_urls() + function replaces_the_original_urls_with_absolute_urls(): void { $run = $this->createRun('main', 'abcde', true); @@ -159,7 +159,7 @@ function replaces_the_original_urls_with_absolute_urls() } #[Test] - function replaces_the_search_file_path_with_the_export_base_path() + function replaces_the_search_file_path_with_the_export_base_path(): void { $run = $this->createRun('main', 'abcde', true); @@ -176,7 +176,7 @@ function replaces_the_search_file_path_with_the_export_base_path() ', 'index.html'); } - private function resetDirectory(Filesystem $filesystem, $dir) + private function resetDirectory(Filesystem $filesystem, $dir): void { if (! $filesystem->isDirectory($dir)) { return; @@ -185,7 +185,7 @@ private function resetDirectory(Filesystem $filesystem, $dir) $filesystem->deleteDirectory($dir); } - private function assertDocumentHasContent(string $expectedContent, $filename) + private function assertDocumentHasContent(string $expectedContent, $filename): void { $this->assertFileExists("{$this->baseDir}/{$filename}"); $this->assertSame($expectedContent, file_get_contents("{$this->baseDir}/$filename")); diff --git a/tests/Console/ExportDocumentationCommandTest.php b/tests/Console/ExportDocumentationCommandTest.php index 7cec732..27a6d1d 100644 --- a/tests/Console/ExportDocumentationCommandTest.php +++ b/tests/Console/ExportDocumentationCommandTest.php @@ -24,7 +24,7 @@ protected function setUp(): void } #[Test] - function exports_a_run_with_a_relative_url() + function exports_a_run_with_a_relative_url(): void { $this->createRun('main', 'abcde', true); $this->createRun('develop', 'fghij', false); @@ -51,7 +51,7 @@ function exports_a_run_with_a_relative_url() } #[Test] - function exports_a_run_with_an_absolute_url() + function exports_a_run_with_an_absolute_url(): void { $this->createRun('main', 'abcde', true); $this->createRun('develop', 'fghij', false); @@ -78,7 +78,7 @@ function exports_a_run_with_an_absolute_url() } #[Test] - function asks_the_user_to_run_the_tests_before_trying_to_export_the_documentation() + function asks_the_user_to_run_the_tests_before_trying_to_export_the_documentation(): void { $this->artisan('enlighten:export') ->expectsOutput('There are no runs available. Please setup `Enlighten` and run the tests first.'); diff --git a/tests/Integration/App/Providers/RouteServiceProvider.php b/tests/Integration/App/Providers/RouteServiceProvider.php index 5584bad..b6e65dd 100644 --- a/tests/Integration/App/Providers/RouteServiceProvider.php +++ b/tests/Integration/App/Providers/RouteServiceProvider.php @@ -30,7 +30,7 @@ class RouteServiceProvider extends ServiceProvider * * @return void */ - public function boot() + public function boot(): void { Route::middleware('web') ->group(__DIR__ . '/../../routes/web.php'); diff --git a/tests/Integration/CaptureCodeExampleTest.php b/tests/Integration/CaptureCodeExampleTest.php index 140e70d..f90bc07 100644 --- a/tests/Integration/CaptureCodeExampleTest.php +++ b/tests/Integration/CaptureCodeExampleTest.php @@ -13,7 +13,7 @@ class CaptureCodeExampleTest extends TestCase { #[Test] - function captures_single_line_snippet() + function captures_single_line_snippet(): void { $sum = Enlighten::test(function () { $a = 1; @@ -43,7 +43,7 @@ function captures_single_line_snippet() } #[Test] - function captures_snippet_with_key() + function captures_snippet_with_key(): void { $msg = Enlighten::test('hello-world', function () { return 'Hello World'; @@ -65,7 +65,7 @@ function captures_snippet_with_key() } #[Test] - function captures_snippet_with_key_using_helper() + function captures_snippet_with_key_using_helper(): void { $msg = enlighten('hello-world-2', function () { return 'Hello World'; @@ -87,7 +87,7 @@ function captures_snippet_with_key_using_helper() } #[Test] - function captures_snippet_with_sql_query() + function captures_snippet_with_sql_query(): void { $user = enlighten(function () { return User::create([ @@ -125,7 +125,7 @@ function captures_snippet_with_sql_query() } #[Test] - function captures_snippet_with_exception() + function captures_snippet_with_exception(): void { $this->expectException(BadMethodCallException::class); @@ -147,7 +147,7 @@ function captures_snippet_with_exception() } #[Test] - function captures_objects_returned_by_snippets() + function captures_objects_returned_by_snippets(): void { enlighten(function () { return new DemoClassForSnippetExample; @@ -176,7 +176,7 @@ function captures_objects_returned_by_snippets() } #[Test] - function captures_objects_returned_by_snippets_with_limited_recursion() + function captures_objects_returned_by_snippets_with_limited_recursion(): void { CodeResultTransformer::$maxNestedLevel = 1; @@ -203,7 +203,7 @@ function captures_objects_returned_by_snippets_with_limited_recursion() } #[Test] - function captures_information_from_functions_returned_by_code_snippets() + function captures_information_from_functions_returned_by_code_snippets(): void { enlighten(function () { return function () { @@ -219,7 +219,7 @@ function captures_information_from_functions_returned_by_code_snippets() } #[Test] - function captures_information_from_functions_with_parameters() + function captures_information_from_functions_with_parameters(): void { enlighten(function () { return function ($a, int $b = 2, \stdClass $anObject = null) { @@ -254,7 +254,7 @@ function captures_information_from_functions_with_parameters() } #[Test] - function captures_information_from_functions_with_return_type() + function captures_information_from_functions_with_return_type(): void { enlighten(function () { return function (): int { @@ -270,7 +270,7 @@ function captures_information_from_functions_with_return_type() } - private function assertFirstSnippetReturns(array $expected) + private function assertFirstSnippetReturns(array $expected): void { $example = Example::firstOrFail(); diff --git a/tests/Integration/CaptureQueriesTest.php b/tests/Integration/CaptureQueriesTest.php index ab322a4..b5cefec 100644 --- a/tests/Integration/CaptureQueriesTest.php +++ b/tests/Integration/CaptureQueriesTest.php @@ -10,7 +10,7 @@ class CaptureQueriesTest extends TestCase { #[Test] - function it_stores_the_queries_executed_during_the_test() + function it_stores_the_queries_executed_during_the_test(): void { User::create([ 'name' => 'Duilio', @@ -65,7 +65,7 @@ function it_stores_the_queries_executed_during_the_test() } #[Test] - function links_queries_to_the_snippet_context() + function links_queries_to_the_snippet_context(): void { $user = enlighten(function () { return User::create([ diff --git a/tests/Integration/Database/migrations/2014_10_12_000000_create_users_table.php b/tests/Integration/Database/migrations/2014_10_12_000000_create_users_table.php index 621a24e..22dec0c 100644 --- a/tests/Integration/Database/migrations/2014_10_12_000000_create_users_table.php +++ b/tests/Integration/Database/migrations/2014_10_12_000000_create_users_table.php @@ -11,7 +11,7 @@ class CreateUsersTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('users', function (Blueprint $table) { $table->id(); @@ -29,7 +29,7 @@ public function up() * * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/tests/Integration/DoesntSaveIrrelevantRouteParametersTest.php b/tests/Integration/DoesntSaveIrrelevantRouteParametersTest.php index 704535d..2c8a1cb 100644 --- a/tests/Integration/DoesntSaveIrrelevantRouteParametersTest.php +++ b/tests/Integration/DoesntSaveIrrelevantRouteParametersTest.php @@ -9,7 +9,7 @@ class DoesntSaveIrrelevantRouteParametersTest extends TestCase { #[Test] - function does_not_save_irrelevant_route_parameters() + function does_not_save_irrelevant_route_parameters(): void { $this->get('parameters/global/local') ->assertOk(); diff --git a/tests/Integration/FailedRequestTest.php b/tests/Integration/FailedRequestTest.php index e436cda..a7df7c9 100644 --- a/tests/Integration/FailedRequestTest.php +++ b/tests/Integration/FailedRequestTest.php @@ -22,7 +22,7 @@ protected function setUp(): void } #[Test] - function creates_example_even_if_the_request_fails() + function creates_example_even_if_the_request_fails(): void { $response = $this->get('/server-error'); @@ -34,7 +34,7 @@ function creates_example_even_if_the_request_fails() } #[Test] - function creates_example_with_request_data_without_exception_handling() + function creates_example_with_request_data_without_exception_handling(): void { $this->withoutExceptionHandling(); @@ -63,7 +63,7 @@ function creates_example_with_request_data_without_exception_handling() } #[Test] - function saves_the_information_from_the_http_exceptions_with_exception_handling() + function saves_the_information_from_the_http_exceptions_with_exception_handling(): void { $this->get('/server-error') ->assertStatus(500); @@ -95,7 +95,7 @@ function saves_the_information_from_the_http_exceptions_with_exception_handling( } #[Test] - function saves_the_information_from_the_http_exceptions_without_exception_handling() + function saves_the_information_from_the_http_exceptions_without_exception_handling(): void { $this->withoutExceptionHandling(); diff --git a/tests/Integration/FollowRedirectionTest.php b/tests/Integration/FollowRedirectionTest.php index 3399a1d..3a7cd1f 100644 --- a/tests/Integration/FollowRedirectionTest.php +++ b/tests/Integration/FollowRedirectionTest.php @@ -9,7 +9,7 @@ class FollowRedirectionTest extends TestCase { #[Test] - function saves_the_first_request_and_the_last_response() + function saves_the_first_request_and_the_last_response(): void { $this->withoutExceptionHandling(); diff --git a/tests/Integration/IgnoreClassViaConfigurationTest.php b/tests/Integration/IgnoreClassViaConfigurationTest.php index 106f240..04d355c 100644 --- a/tests/Integration/IgnoreClassViaConfigurationTest.php +++ b/tests/Integration/IgnoreClassViaConfigurationTest.php @@ -18,7 +18,7 @@ protected function setUp(): void } #[Test] - function does_not_export_test_classes_ignored_in_the_configuration() + function does_not_export_test_classes_ignored_in_the_configuration(): void { $this->assertExampleIsNotCreated(); } diff --git a/tests/Integration/IgnoreClassWithAnnotationTest.php b/tests/Integration/IgnoreClassWithAnnotationTest.php index e8ecfdd..c44e3f6 100644 --- a/tests/Integration/IgnoreClassWithAnnotationTest.php +++ b/tests/Integration/IgnoreClassWithAnnotationTest.php @@ -10,7 +10,7 @@ class IgnoreClassWithAnnotationTest extends TestCase { #[Test] - function does_not_export_test_classes_with_the_enlighten_ignore_annotation() + function does_not_export_test_classes_with_the_enlighten_ignore_annotation(): void { $this->assertExampleIsNotCreated(); } diff --git a/tests/Integration/IgnoreMethodsTest.php b/tests/Integration/IgnoreMethodsTest.php index e2db949..fb1812c 100644 --- a/tests/Integration/IgnoreMethodsTest.php +++ b/tests/Integration/IgnoreMethodsTest.php @@ -20,13 +20,13 @@ protected function setUp(): void } #[Test] - function does_not_export_test_methods_ignored_in_the_configuration() + function does_not_export_test_methods_ignored_in_the_configuration(): void { $this->assertExampleIsNotCreated(); } #[Test] - function can_use_wildcards_to_ignore_a_test_method_in_the_configuration() + function can_use_wildcards_to_ignore_a_test_method_in_the_configuration(): void { $this->assertExampleIsNotCreated(); } @@ -35,7 +35,7 @@ function can_use_wildcards_to_ignore_a_test_method_in_the_configuration() /** * @enlighten {"ignore": true} */ - function does_not_export_test_methods_with_the_enlighten_ignore_annotation() + function does_not_export_test_methods_with_the_enlighten_ignore_annotation(): void { $this->assertExampleIsNotCreated(); } @@ -44,7 +44,7 @@ function does_not_export_test_methods_with_the_enlighten_ignore_annotation() /** * @enlighten {"ignore": true} */ - function can_ignore_test_methods_that_throw_an_http_exception() + function can_ignore_test_methods_that_throw_an_http_exception(): void { $response = $this->post('not-found', [ 'name' => 'Duilio', diff --git a/tests/Integration/IncludeClassWithAnnotationTest.php b/tests/Integration/IncludeClassWithAnnotationTest.php index 799ab2e..4dddb6f 100644 --- a/tests/Integration/IncludeClassWithAnnotationTest.php +++ b/tests/Integration/IncludeClassWithAnnotationTest.php @@ -19,7 +19,7 @@ protected function setUp(): void } #[Test] - function export_test_classes_with_the_enlighten_annotation_even_if_its_ignored_in_the_config() + function export_test_classes_with_the_enlighten_annotation_even_if_its_ignored_in_the_config(): void { $this->assertExampleIsCreated(); } diff --git a/tests/Integration/IncludeMethodWithAnnotationTest.php b/tests/Integration/IncludeMethodWithAnnotationTest.php index ea4fb08..a4e201c 100644 --- a/tests/Integration/IncludeMethodWithAnnotationTest.php +++ b/tests/Integration/IncludeMethodWithAnnotationTest.php @@ -19,13 +19,13 @@ protected function setUp(): void /** * @enlighten */ - function export_test_method_with_the_enlighten_annotation_even_if_its_ignored_in_the_config() + function export_test_method_with_the_enlighten_annotation_even_if_its_ignored_in_the_config(): void { $this->assertExampleIsCreated(); } #[Test] - function it_does_not_export_test_method_ignored_with_the_config() + function it_does_not_export_test_method_ignored_with_the_config(): void { $this->assertExampleIsNotCreated(); } diff --git a/tests/Integration/ListUsersTest.php b/tests/Integration/ListUsersTest.php index c108dd9..91ff78a 100644 --- a/tests/Integration/ListUsersTest.php +++ b/tests/Integration/ListUsersTest.php @@ -16,7 +16,7 @@ class ListUsersTest extends TestCase /** * @description Obtiene los nombres y correos electrónicos de todos los usuarios registrados en el sistema. */ - function gets_the_list_of_users() + function gets_the_list_of_users(): void { $this->withoutExceptionHandling(); diff --git a/tests/Integration/MultipleRequestsTest.php b/tests/Integration/MultipleRequestsTest.php index d8b47d2..1159b20 100644 --- a/tests/Integration/MultipleRequestsTest.php +++ b/tests/Integration/MultipleRequestsTest.php @@ -9,7 +9,7 @@ class MultipleRequestsTest extends TestCase { #[Test] - function can_store_multiple_requests() + function can_store_multiple_requests(): void { $this->withoutExceptionHandling(); diff --git a/tests/Integration/PostRequestTest.php b/tests/Integration/PostRequestTest.php index 32d438a..e3e332e 100644 --- a/tests/Integration/PostRequestTest.php +++ b/tests/Integration/PostRequestTest.php @@ -19,7 +19,7 @@ protected function setUp(): void } #[Test] - function creates_an_example_of_a_post_request() + function creates_an_example_of_a_post_request(): void { $this->withoutExceptionHandling(); @@ -57,7 +57,7 @@ function creates_an_example_of_a_post_request() } #[Test] - function saves_validation_errors() + function saves_validation_errors(): void { $response = $this->post('user', [ 'name' => 'Duilio', diff --git a/tests/Integration/RouteNotFoundTest.php b/tests/Integration/RouteNotFoundTest.php index e0927f4..d0c90b1 100644 --- a/tests/Integration/RouteNotFoundTest.php +++ b/tests/Integration/RouteNotFoundTest.php @@ -8,7 +8,7 @@ class RouteNotFoundTest extends TestCase { #[Test] - function gets_a_non_existing_url() + function gets_a_non_existing_url(): void { $this->get('not-found-url') ->assertNotFound(); diff --git a/tests/Integration/SavesOrderAnnotationTest.php b/tests/Integration/SavesOrderAnnotationTest.php index 3a9ad6e..246f3df 100644 --- a/tests/Integration/SavesOrderAnnotationTest.php +++ b/tests/Integration/SavesOrderAnnotationTest.php @@ -14,7 +14,7 @@ class SavesOrderAnnotationTest extends TestCase /** * @enlighten {"order": 22} */ - function it_saves_an_example_and_example_group_with_an_order_num_attribute() + function it_saves_an_example_and_example_group_with_an_order_num_attribute(): void { $this->saveExampleStatus(); diff --git a/tests/Integration/StringResponseTest.php b/tests/Integration/StringResponseTest.php index 825a132..203e572 100644 --- a/tests/Integration/StringResponseTest.php +++ b/tests/Integration/StringResponseTest.php @@ -11,7 +11,7 @@ class StringResponseTest extends TestCase { #[Test] - function a_response_can_return_a_string() + function a_response_can_return_a_string(): void { $this->get('api/text') ->assertOk() @@ -41,7 +41,7 @@ function a_response_can_return_a_string() } #[Test] - function a_json_response_can_be_a_string() + function a_json_response_can_be_a_string(): void { $this->get('api/json-string') ->assertOk() diff --git a/tests/Integration/UploadFileTest.php b/tests/Integration/UploadFileTest.php index b7a9e3e..ab4f7bd 100644 --- a/tests/Integration/UploadFileTest.php +++ b/tests/Integration/UploadFileTest.php @@ -9,7 +9,7 @@ class UploadFileTest extends TestCase { #[Test] - function documents_file_parameters() + function documents_file_parameters(): void { $this->withoutExceptionHandling(); diff --git a/tests/Integration/WorksWithDataProvidersTest.php b/tests/Integration/WorksWithDataProvidersTest.php index d762102..006a85d 100644 --- a/tests/Integration/WorksWithDataProvidersTest.php +++ b/tests/Integration/WorksWithDataProvidersTest.php @@ -14,7 +14,7 @@ class WorksWithDataProvidersTest extends TestCase #[Test] #[TestWith(['dataset1'])] #[TestWith(['dataset2'])] - function can_store_information_of_tests_with_data_provider_from_annotation($data) + function can_store_information_of_tests_with_data_provider_from_annotation($data): void { $this->assertTrue(strpos($data, 'dataset') === 0); @@ -28,7 +28,7 @@ function can_store_information_of_tests_with_data_provider_from_annotation($data #[Test] #[DataProvider('dataProviderMethod')] - function can_store_information_of_tests_with_data_providers_from_method($data) + function can_store_information_of_tests_with_data_providers_from_method($data): void { $this->assertTrue(strpos($data, 'dataset') === 0); @@ -52,7 +52,7 @@ public static function dataProviderMethod(): array #[Test] #[DataProvider('dataProviderWithObjects')] - function stores_information_of_objects_returned_by_data_providers($object) + function stores_information_of_objects_returned_by_data_providers($object): void { $this->assertInstanceOf(StdClass::class, $object); $this->assertSame('dataset1', $object->property); @@ -84,7 +84,7 @@ public static function dataProviderWithObjects(): array #[Test] #[DataProvider('dataProviderWithFunctions')] - function stores_information_of_functions_returned_by_data_providers($function) + function stores_information_of_functions_returned_by_data_providers($function): void { $this->assertInstanceOf(\Closure::class, $function); $this->assertSame('test', $function()); @@ -119,7 +119,7 @@ public static function dataProviderWithFunctions(): array #[Test] #[DataProvider('providedDataWithKeys')] - function adds_key_from_the_data_provider_at_the_end_of_the_title($num1, $num2) + function adds_key_from_the_data_provider_at_the_end_of_the_title($num1, $num2): void { $this->assertSame(3, $num1 + $num2); diff --git a/tests/TestHelpers.php b/tests/TestHelpers.php index b39597d..0c0338d 100644 --- a/tests/TestHelpers.php +++ b/tests/TestHelpers.php @@ -155,7 +155,7 @@ protected function redirectResponseBody() // Custom assertions - public function assertArrayable($expected, $arrayable) + public function assertArrayable($expected, $arrayable): void { $this->assertInstanceOf(Arrayable::class, $arrayable); $this->assertSame($expected, $arrayable->toArray()); diff --git a/tests/Unit/AnnotationsTest.php b/tests/Unit/AnnotationsTest.php index ff64d4a..5bd71aa 100644 --- a/tests/Unit/AnnotationsTest.php +++ b/tests/Unit/AnnotationsTest.php @@ -15,7 +15,7 @@ class AnnotationsTest extends TestCase { #[Test] - function gets_annotations_from_class() + function gets_annotations_from_class(): void { $annotations = (new Annotations)->getFromClass(AnnotationsTest::class); @@ -31,7 +31,7 @@ function gets_annotations_from_class() * @title Gets annotations from methods * @description It can get the annotation from a method. */ - function gets_annotations_from_methods() + function gets_annotations_from_methods(): void { $annotations = (new Annotations)->getFromMethod(AnnotationsTest::class, 'gets_annotations_from_methods'); @@ -43,7 +43,7 @@ function gets_annotations_from_methods() } /** @enlighten {"order": 4} **/ - function test_gets_single_line_annotation() + function test_gets_single_line_annotation(): void { $annotations = (new Annotations)->getFromMethod(AnnotationsTest::class, 'test_gets_single_line_annotation'); @@ -60,7 +60,7 @@ function test_gets_single_line_annotation() * that span * across multiple lines */ - function gets_multiline_annotations() + function gets_multiline_annotations(): void { $annotations = (new Annotations)->getFromMethod(AnnotationsTest::class, 'gets_multiline_annotations'); diff --git a/tests/Unit/ChecksLaravelPresenceTest.php b/tests/Unit/ChecksLaravelPresenceTest.php index 7db3595..66bf18e 100644 --- a/tests/Unit/ChecksLaravelPresenceTest.php +++ b/tests/Unit/ChecksLaravelPresenceTest.php @@ -18,7 +18,7 @@ protected function setUp(): void } #[Test] - function throws_exception_when_calling_the_enlighten_helper_without_booting_laravel() + function throws_exception_when_calling_the_enlighten_helper_without_booting_laravel(): void { try { enlighten(function () { @@ -32,7 +32,7 @@ function throws_exception_when_calling_the_enlighten_helper_without_booting_lara } #[Test] - function throws_exception_when_calling_the_enlighten_test_facade_without_booting_laravel() + function throws_exception_when_calling_the_enlighten_test_facade_without_booting_laravel(): void { try { Enlighten::test(function () { @@ -45,7 +45,7 @@ function throws_exception_when_calling_the_enlighten_test_facade_without_booting $this->fail('The exception LaravelNotPresent was not thrown'); } - private function passed() + private function passed(): void { $this->assertTrue(true); } diff --git a/tests/Unit/DatabaseRunBuilderTest.php b/tests/Unit/DatabaseRunBuilderTest.php index 41ddf41..aa39237 100644 --- a/tests/Unit/DatabaseRunBuilderTest.php +++ b/tests/Unit/DatabaseRunBuilderTest.php @@ -13,7 +13,7 @@ class DatabaseRunBuilderTest extends TestCase { #[Test] - function can_reset_a_test_run() + function can_reset_a_test_run(): void { $testRunBuilder = $this->app->make(DatabaseRunBuilder::class); @@ -29,7 +29,7 @@ function can_reset_a_test_run() } #[Test] - function can_get_info_from_a_custom_version_control_system() + function can_get_info_from_a_custom_version_control_system(): void { $this->app->instance(VersionControl::class, new class implements VersionControl { public function currentBranch(): string diff --git a/tests/Unit/DisableEnlightenTest.php b/tests/Unit/DisableEnlightenTest.php index 61fba42..258ebcb 100644 --- a/tests/Unit/DisableEnlightenTest.php +++ b/tests/Unit/DisableEnlightenTest.php @@ -9,7 +9,7 @@ class DisableEnlightenTest extends TestCase { #[Test] - function enlighten_dashboard_can_be_enabled() + function enlighten_dashboard_can_be_enabled(): void { $this->setConfig([ 'enlighten.dashboard' => true, diff --git a/tests/Unit/ExampleGeneratorTest.php b/tests/Unit/ExampleGeneratorTest.php index 69cb259..aa10862 100644 --- a/tests/Unit/ExampleGeneratorTest.php +++ b/tests/Unit/ExampleGeneratorTest.php @@ -9,7 +9,7 @@ class ExampleGeneratorTest extends TestCase { #[Test] - function the_example_generator_is_registered_as_singleton() + function the_example_generator_is_registered_as_singleton(): void { $this->assertSame(app(HttpExampleCreator::class), app(HttpExampleCreator::class)); } diff --git a/tests/Unit/ExportCodeResultTest.php b/tests/Unit/ExportCodeResultTest.php index d18e60a..c17e86d 100644 --- a/tests/Unit/ExportCodeResultTest.php +++ b/tests/Unit/ExportCodeResultTest.php @@ -25,7 +25,7 @@ protected function setUp(): void } #[Test] - function export_simple_code_snippets() + function export_simple_code_snippets(): void { $this->assertExports('2020', 2020); $this->assertExports('0.4', 0.4); @@ -35,7 +35,7 @@ function export_simple_code_snippets() } #[Test] - function export_simple_array_code_snippet() + function export_simple_array_code_snippet(): void { $expected = [ '[', @@ -53,7 +53,7 @@ function export_simple_array_code_snippet() } #[Test] - function export_associative_array_code_snippet() + function export_associative_array_code_snippet(): void { $data = [ 'name' => 'Enlighten', @@ -71,7 +71,7 @@ function export_associative_array_code_snippet() } #[Test] - function export_code_snippet_with_nested_arrays() + function export_code_snippet_with_nested_arrays(): void { $data = [ 'Enlighten', @@ -94,7 +94,7 @@ function export_code_snippet_with_nested_arrays() } #[Test] - function export_code_snippet_with_class() + function export_code_snippet_with_class(): void { $data = [ ExampleSnippet::CLASS_NAME => 'Tests\Integration\DemoClassForSnippetExample', @@ -113,7 +113,7 @@ function export_code_snippet_with_class() } #[Test] - function export_code_snippet_with_nested_classes() + function export_code_snippet_with_nested_classes(): void { $data = [ ExampleSnippet::CLASS_NAME => 'Tests\Integration\DemoClassForSnippetExample', @@ -141,7 +141,7 @@ function export_code_snippet_with_nested_classes() } #[Test] - function export_code_with_nested_classes_and_arrays() + function export_code_with_nested_classes_and_arrays(): void { $data = CodeResultTransformer::export([ 'package' => 'Enlighten', @@ -166,7 +166,7 @@ function export_code_with_nested_classes_and_arrays() $this->assertExports($expected, $data); } - private function assertExports($segments, $value) + private function assertExports($segments, $value): void { $expectedCode = collect($segments) ->map(function ($segment) { diff --git a/tests/Unit/GeneratesSlugFromClassNameTest.php b/tests/Unit/GeneratesSlugFromClassNameTest.php index ea268aa..348fc32 100644 --- a/tests/Unit/GeneratesSlugFromClassNameTest.php +++ b/tests/Unit/GeneratesSlugFromClassNameTest.php @@ -9,7 +9,7 @@ class GeneratesSlugFromClassNameTest extends TestCase { #[Test] - function generates_slug_from_class_name() + function generates_slug_from_class_name(): void { $this->assertSame('feature-list-users', Settings::generateSlugFromClassName('Tests\Feature\ListUsersTest')); @@ -26,7 +26,7 @@ function generates_slug_from_class_name() } #[Test] - function generates_slug_from_class_name_with_a_custom_generator() + function generates_slug_from_class_name_with_a_custom_generator(): void { Settings::setCustomSlugGenerator(function ($className, $from) { $this->assertSame('class', $from); diff --git a/tests/Unit/GeneratesSlugFromMethodNameTest.php b/tests/Unit/GeneratesSlugFromMethodNameTest.php index d64451e..e6f8bf8 100644 --- a/tests/Unit/GeneratesSlugFromMethodNameTest.php +++ b/tests/Unit/GeneratesSlugFromMethodNameTest.php @@ -9,7 +9,7 @@ class GeneratesSlugFromMethodNameTest extends TestCase { #[Test] - function generates_slug_from_method_name() + function generates_slug_from_method_name(): void { $this->assertSame('it-list-users', Settings::generateSlugFromMethodName('it_list_users')); @@ -21,7 +21,7 @@ function generates_slug_from_method_name() } #[Test] - function generates_slug_from_class_name_with_a_custom_generator() + function generates_slug_from_class_name_with_a_custom_generator(): void { Settings::setCustomSlugGenerator(function ($methodName, $from) { $this->assertSame('method', $from); diff --git a/tests/Unit/GeneratesTitleFromClassNameTest.php b/tests/Unit/GeneratesTitleFromClassNameTest.php index d714275..05d2e20 100644 --- a/tests/Unit/GeneratesTitleFromClassNameTest.php +++ b/tests/Unit/GeneratesTitleFromClassNameTest.php @@ -10,7 +10,7 @@ class GeneratesTitleFromClassNameTest extends TestCase { #[Test] - function generates_title_from_class_name() + function generates_title_from_class_name(): void { $this->assertSame('List Users', Settings::generateTitle('class', 'ListUsersTest')); @@ -22,7 +22,7 @@ function generates_title_from_class_name() } #[Test] - function generates_title_from_class_name_with_a_custom_generator() + function generates_title_from_class_name_with_a_custom_generator(): void { Settings::setCustomTitleGenerator(function ($type, $className) { $this->assertSame('class', $type); diff --git a/tests/Unit/GeneratesTitleFromMethodNameTest.php b/tests/Unit/GeneratesTitleFromMethodNameTest.php index 4d78256..d70e624 100644 --- a/tests/Unit/GeneratesTitleFromMethodNameTest.php +++ b/tests/Unit/GeneratesTitleFromMethodNameTest.php @@ -9,7 +9,7 @@ class GeneratesTitleFromMethodNameTest extends TestCase { #[Test] - function generates_a_title_from_test_method_names_in_camel_case_format() + function generates_a_title_from_test_method_names_in_camel_case_format(): void { $this->assertSame( 'Generates title from camel case format', @@ -18,7 +18,7 @@ function generates_a_title_from_test_method_names_in_camel_case_format() } #[Test] - function generates_a_title_from_test_method_names_in_snake_format() + function generates_a_title_from_test_method_names_in_snake_format(): void { $this->assertSame( 'Generates title from snake format', @@ -27,7 +27,7 @@ function generates_a_title_from_test_method_names_in_snake_format() } #[Test] - function generates_titles_without_including_the_test_prefix() + function generates_titles_without_including_the_test_prefix(): void { $this->assertSame( 'It removes the test prefix', @@ -41,7 +41,7 @@ function generates_titles_without_including_the_test_prefix() } #[Test] - function generates_title_with_a_custom_generator() + function generates_title_with_a_custom_generator(): void { Settings::setCustomTitleGenerator(function ($type, $methodName) { $this->assertSame('method', $type); diff --git a/tests/Unit/GetsAreaSlugTest.php b/tests/Unit/GetsAreaSlugTest.php index 6a4d34c..36da421 100644 --- a/tests/Unit/GetsAreaSlugTest.php +++ b/tests/Unit/GetsAreaSlugTest.php @@ -9,14 +9,14 @@ class GetsAreaSlugTest extends TestCase { #[Test] - function gets_the_slug_of_an_area_from_a_class_name() + function gets_the_slug_of_an_area_from_a_class_name(): void { $this->assertSame('feature', Settings::getAreaSlug('Tests\Feature\ListUsers')); $this->assertSame('api', Settings::getAreaSlug('Tests\Api\CreateUser')); } #[Test] - function can_resolve_the_area_with_a_custom_resolver() + function can_resolve_the_area_with_a_custom_resolver(): void { Settings::setCustomAreaResolver(function ($className) { return explode('\\', $className)[3]; diff --git a/tests/Unit/GuessDatabaseNameTest.php b/tests/Unit/GuessDatabaseNameTest.php index 5b5874b..55a99be 100644 --- a/tests/Unit/GuessDatabaseNameTest.php +++ b/tests/Unit/GuessDatabaseNameTest.php @@ -11,7 +11,7 @@ class GuessDatabaseNameTest extends TestCase use RegistersDatabaseConnection; #[Test] - function guesses_the_database_name() + function guesses_the_database_name(): void { $config = [ 'driver' => 'sqlite', diff --git a/tests/Unit/HidesSectionsTest.php b/tests/Unit/HidesSectionsTest.php index 3f166b7..40c8aab 100644 --- a/tests/Unit/HidesSectionsTest.php +++ b/tests/Unit/HidesSectionsTest.php @@ -10,7 +10,7 @@ class HidesSectionsTest extends TestCase { #[Test] - function determines_if_a_section_should_be_hidden() + function determines_if_a_section_should_be_hidden(): void { $this->assertFalse(Settings::hide(Section::QUERIES)); $this->assertTrue(Settings::show(Section::QUERIES)); diff --git a/tests/Unit/Models/AreaTest.php b/tests/Unit/Models/AreaTest.php index f6201dc..c3d0d84 100644 --- a/tests/Unit/Models/AreaTest.php +++ b/tests/Unit/Models/AreaTest.php @@ -10,7 +10,7 @@ class AreaTest extends TestCase { #[Test] - function get_all_the_areas_from_the_current_run() + function get_all_the_areas_from_the_current_run(): void { config([ 'enlighten.areas' => [] @@ -45,7 +45,7 @@ function get_all_the_areas_from_the_current_run() } #[Test] - function get_all_the_areas_from_the_current_groups_with_a_custom_area_resolver() + function get_all_the_areas_from_the_current_groups_with_a_custom_area_resolver(): void { $this->setConfig([ 'enlighten.areas' => [] @@ -77,7 +77,7 @@ function get_all_the_areas_from_the_current_groups_with_a_custom_area_resolver() } #[Test] - function gets_all_the_areas_from_the_configuration() + function gets_all_the_areas_from_the_configuration(): void { $this->setConfig([ 'enlighten.areas' => [ diff --git a/tests/Unit/Models/EndpointTest.php b/tests/Unit/Models/EndpointTest.php index 716db96..a0fc019 100644 --- a/tests/Unit/Models/EndpointTest.php +++ b/tests/Unit/Models/EndpointTest.php @@ -9,7 +9,7 @@ class EndpointTest extends TestCase { #[Test] - function make_an_endpoint_instance() + function make_an_endpoint_instance(): void { $endpoint = new Endpoint('GET', '/users'); diff --git a/tests/Unit/Models/ExampleGroupTest.php b/tests/Unit/Models/ExampleGroupTest.php index ca29d2c..c441922 100644 --- a/tests/Unit/Models/ExampleGroupTest.php +++ b/tests/Unit/Models/ExampleGroupTest.php @@ -58,7 +58,7 @@ public function get_the_stats_of_an_example_group(): void } #[Test] - function get_the_example_group_url() + function get_the_example_group_url(): void { $exampleGroup = new ExampleGroup([ 'run_id' => 1, @@ -76,7 +76,7 @@ function get_the_example_group_url() } #[Test] - function get_the_example_group_area_as_a_title() + function get_the_example_group_area_as_a_title(): void { $exampleGroup = new ExampleGroup([ 'area' => 'feature', diff --git a/tests/Unit/Models/ExampleRequestTest.php b/tests/Unit/Models/ExampleRequestTest.php index 93c59b3..7f3aaa2 100644 --- a/tests/Unit/Models/ExampleRequestTest.php +++ b/tests/Unit/Models/ExampleRequestTest.php @@ -12,7 +12,7 @@ class ExampleRequestTest extends TestCase { #[Test] - function an_example_can_have_many_requests() + function an_example_can_have_many_requests(): void { $run = $this->createRun(); @@ -34,7 +34,7 @@ function an_example_can_have_many_requests() } #[Test] - function an_example_request_belongs_to_an_example() + function an_example_request_belongs_to_an_example(): void { $example = $this->createExample(); $request = $example->requests()->create($this->getExampleRequestAttributes()); @@ -44,7 +44,7 @@ function an_example_request_belongs_to_an_example() } #[Test] - function gets_the_full_path_of_the_request() + function gets_the_full_path_of_the_request(): void { $data = new ExampleRequest([ 'request_path' => 'api/users', @@ -61,7 +61,7 @@ function gets_the_full_path_of_the_request() } #[Test] - function gets_the_response_type_in_a_readable_format() + function gets_the_response_type_in_a_readable_format(): void { $data = new ExampleRequest([ 'response_headers' => [ @@ -87,7 +87,7 @@ function gets_the_response_type_in_a_readable_format() } #[Test] - function checks_if_a_response_is_a_redirect() + function checks_if_a_response_is_a_redirect(): void { $data = new ExampleRequest([ 'response_status' => 200, @@ -115,7 +115,7 @@ function checks_if_a_response_is_a_redirect() } #[Test] - function gets_redirection_location_from_the_response() + function gets_redirection_location_from_the_response(): void { $data = new ExampleRequest([ 'response_headers' => ['location' => ['http://localhost/foo']], diff --git a/tests/Unit/Models/ExampleTest.php b/tests/Unit/Models/ExampleTest.php index 529c0ff..4613514 100644 --- a/tests/Unit/Models/ExampleTest.php +++ b/tests/Unit/Models/ExampleTest.php @@ -10,7 +10,7 @@ class ExampleTest extends TestCase { #[Test] - function gets_the_path_to_the_file() + function gets_the_path_to_the_file(): void { $example = new Example([ 'line' => 3, @@ -23,7 +23,7 @@ function gets_the_path_to_the_file() } #[Test] - function get_the_example_url() + function get_the_example_url(): void { $exampleGroup = new ExampleGroup([ 'run_id' => 1, @@ -40,7 +40,7 @@ function get_the_example_url() } #[Test] - function get_the_signature_of_an_example() + function get_the_signature_of_an_example(): void { $group = $this->createExampleGroup(null, 'Namespace\NameOfTheClass'); diff --git a/tests/Unit/Models/HideRequestHeadersTest.php b/tests/Unit/Models/HideRequestHeadersTest.php index c6c9911..22caeb6 100644 --- a/tests/Unit/Models/HideRequestHeadersTest.php +++ b/tests/Unit/Models/HideRequestHeadersTest.php @@ -9,7 +9,7 @@ class HideRequestHeadersTest extends TestCase { #[Test] - function hides_request_headers() + function hides_request_headers(): void { $request = new ExampleRequest([ 'request_headers' => [ @@ -34,7 +34,7 @@ function hides_request_headers() } #[Test] - function can_overwrite_headers() + function can_overwrite_headers(): void { $request = new ExampleRequest([ 'request_headers' => [ @@ -58,7 +58,7 @@ function can_overwrite_headers() } #[Test] - function hidden_headers_take_precedence_over_overwritten_headers() + function hidden_headers_take_precedence_over_overwritten_headers(): void { $request = new ExampleRequest([ 'request_headers' => [ diff --git a/tests/Unit/Models/HideRequestInputTest.php b/tests/Unit/Models/HideRequestInputTest.php index bd4bb49..35386ff 100644 --- a/tests/Unit/Models/HideRequestInputTest.php +++ b/tests/Unit/Models/HideRequestInputTest.php @@ -9,7 +9,7 @@ class HideRequestInputTest extends TestCase { #[Test] - function can_hide_and_overwrite_request_input_values() + function can_hide_and_overwrite_request_input_values(): void { $request = new ExampleRequest([ 'request_input' => [ diff --git a/tests/Unit/Models/HideRequestQueryParametersTest.php b/tests/Unit/Models/HideRequestQueryParametersTest.php index b731691..d0c2ea2 100644 --- a/tests/Unit/Models/HideRequestQueryParametersTest.php +++ b/tests/Unit/Models/HideRequestQueryParametersTest.php @@ -9,7 +9,7 @@ class HideRequestQueryParametersTest extends TestCase { #[Test] - function can_remove_and_overwrite_query_parameters() + function can_remove_and_overwrite_query_parameters(): void { $request = new ExampleRequest([ 'request_query_parameters' => [ diff --git a/tests/Unit/Models/HideResponseDataTest.php b/tests/Unit/Models/HideResponseDataTest.php index fd1ac45..c397eef 100644 --- a/tests/Unit/Models/HideResponseDataTest.php +++ b/tests/Unit/Models/HideResponseDataTest.php @@ -9,7 +9,7 @@ class HideResponseDataTest extends TestCase { #[Test] - function can_hide_and_overwrite_response_headers() + function can_hide_and_overwrite_response_headers(): void { $request = new ExampleRequest([ 'response_headers' => [ @@ -37,7 +37,7 @@ function can_hide_and_overwrite_response_headers() } #[Test] - function can_hide_and_overwrite_data_from_a_json_response_body() + function can_hide_and_overwrite_data_from_a_json_response_body(): void { $request = new ExampleRequest([ 'response_headers' => ['content-type' => ['application/json']], diff --git a/tests/Unit/Models/HideSessionDataTest.php b/tests/Unit/Models/HideSessionDataTest.php index 9bfb716..1600638 100644 --- a/tests/Unit/Models/HideSessionDataTest.php +++ b/tests/Unit/Models/HideSessionDataTest.php @@ -9,7 +9,7 @@ class HideSessionDataTest extends TestCase { #[Test] - function can_hide_and_overwrite_request_input_values() + function can_hide_and_overwrite_request_input_values(): void { $request = new ExampleRequest([ 'session_data' => [ diff --git a/tests/Unit/Models/ModuleCollectionTest.php b/tests/Unit/Models/ModuleCollectionTest.php index 3c13be6..314068d 100644 --- a/tests/Unit/Models/ModuleCollectionTest.php +++ b/tests/Unit/Models/ModuleCollectionTest.php @@ -13,7 +13,7 @@ class ModuleCollectionTest extends TestCase { #[Test] - function can_create_a_module_collection() + function can_create_a_module_collection(): void { $modules = ModuleCollection::make([ new Module('Users', ['*UserTest*', '*UsersTest*']), @@ -26,7 +26,7 @@ function can_create_a_module_collection() } #[Test] - function add_example_groups_to_the_modules_in_the_module_collection() + function add_example_groups_to_the_modules_in_the_module_collection(): void { $modules = ModuleCollection::make([ new Module('Users', ['*UserTest*', '*UsersTest*']), @@ -64,7 +64,7 @@ function add_example_groups_to_the_modules_in_the_module_collection() ]); } - public function assertModuleHasGroups(ModuleCollection $modules, $name, array $expectedGroups) + public function assertModuleHasGroups(ModuleCollection $modules, $name, array $expectedGroups): void { $module = $modules->getByName($name); @@ -91,7 +91,7 @@ public function remove_modules_without_example_groups_from_the_module_collection } #[Test] - function add_endpoint_groups_to_the_modules_in_the_module_collection() + function add_endpoint_groups_to_the_modules_in_the_module_collection(): void { $modules = ModuleCollection::make([ new Module('Users', [], ['/users*', '/user/*']), @@ -113,7 +113,7 @@ function add_endpoint_groups_to_the_modules_in_the_module_collection() $this->assertModuleHasEndpoints($modules, 'Other Modules', ['POST /likes']); } - public function assertModuleHasEndpoints(ModuleCollection $modules, $name, array $expectedGroups) + public function assertModuleHasEndpoints(ModuleCollection $modules, $name, array $expectedGroups): void { $module = $modules->getByName($name); diff --git a/tests/Unit/Models/RunTest.php b/tests/Unit/Models/RunTest.php index 7e650be..7c501af 100644 --- a/tests/Unit/Models/RunTest.php +++ b/tests/Unit/Models/RunTest.php @@ -11,7 +11,7 @@ class RunTest extends TestCase { #[Test] - function gets_the_signature_of_a_run() + function gets_the_signature_of_a_run(): void { $run = $this->createRun('main', 'abcde', true); $this->assertSame('main * abcde', $run->signature); @@ -21,7 +21,7 @@ function gets_the_signature_of_a_run() } #[Test] - function gets_the_url_of_the_run() + function gets_the_url_of_the_run(): void { $run = $this->createRun(); @@ -29,7 +29,7 @@ function gets_the_url_of_the_run() } #[Test] - function gets_the_base_url_of_the_run() + function gets_the_base_url_of_the_run(): void { $run = $this->createRun(); @@ -37,7 +37,7 @@ function gets_the_base_url_of_the_run() } #[Test] - function gets_the_url_of_a_run_area() + function gets_the_url_of_a_run_area(): void { $run = $this->createRun(); @@ -45,7 +45,7 @@ function gets_the_url_of_a_run_area() } #[Test] - function a_run_has_many_groups() + function a_run_has_many_groups(): void { $run = $this->createRun(); @@ -56,7 +56,7 @@ function a_run_has_many_groups() } #[Test] - function gets_the_areas_of_a_run() + function gets_the_areas_of_a_run(): void { $run = $this->createRun(); diff --git a/tests/Unit/Models/StatusTest.php b/tests/Unit/Models/StatusTest.php index e005ea1..499f43b 100644 --- a/tests/Unit/Models/StatusTest.php +++ b/tests/Unit/Models/StatusTest.php @@ -11,7 +11,7 @@ class StatusTest extends TestCase { #[Test] #[DataProvider('getStatusEquivalences')] - function gets_a_simplified_status($testStatus, $expectedStatus) + function gets_a_simplified_status($testStatus, $expectedStatus): void { $this->assertSame($expectedStatus, Status::fromTestStatus($testStatus)); } diff --git a/tests/Unit/MultilanguageTest.php b/tests/Unit/MultilanguageTest.php index 3d1670c..64ea7fd 100644 --- a/tests/Unit/MultilanguageTest.php +++ b/tests/Unit/MultilanguageTest.php @@ -8,7 +8,7 @@ class MultilanguageTest extends TestCase { #[Test] - public function loads_english_and_spanish_branch_commit_message_correctly() + public function loads_english_and_spanish_branch_commit_message_correctly(): void { \App::setLocale('en'); @@ -26,7 +26,7 @@ public function loads_english_and_spanish_branch_commit_message_correctly() } #[Test] - public function loads_english_and_spanish_dashboard_message_correctly() + public function loads_english_and_spanish_dashboard_message_correctly(): void { \App::setLocale('en'); diff --git a/tests/Unit/RequestInspectorTest.php b/tests/Unit/RequestInspectorTest.php index 7179b09..1379bd7 100644 --- a/tests/Unit/RequestInspectorTest.php +++ b/tests/Unit/RequestInspectorTest.php @@ -12,7 +12,7 @@ class RequestInspectorTest extends TestCase { #[Test] - function gets_the_form_data_from_the_request_without_query_parameters() + function gets_the_form_data_from_the_request_without_query_parameters(): void { $request = new Request([ 'query' => 'parameter',