From db6464b5bba37f11af3d42db973cbbf616ad1909 Mon Sep 17 00:00:00 2001 From: James Freeman Date: Thu, 3 Mar 2022 07:58:20 +0000 Subject: [PATCH 1/4] allow constraints --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 3d08110d..d817732b 100644 --- a/composer.json +++ b/composer.json @@ -19,18 +19,18 @@ "php": "^8.0.0|^8.1.0", "ext-json": "*", "doctrine/dbal": "^3.1", - "illuminate/bus": "^8.11", - "illuminate/console": "^8.11", - "illuminate/contracts": "^8.11", - "illuminate/database": "^8.11", - "illuminate/events": "^8.11", - "illuminate/notifications": "^8.11", + "illuminate/bus": "^8.11|^9.0", + "illuminate/console": "^8.11|^9.0", + "illuminate/contracts": "^8.11|^9.0", + "illuminate/database": "^8.11|^9.0", + "illuminate/events": "^8.11|^9.0", + "illuminate/notifications": "^8.11|^9.0", "laravelcollective/html": "^6.0" }, "require-dev": { "mockery/mockery": "^1.0", - "orchestra/database": "^6.0", - "orchestra/testbench" : "^6.0", + "orchestra/database": "^6.0|^7.0", + "orchestra/testbench" : "^6.0|^7.0", "phpunit/phpunit": "^9.0" }, "suggest": { From 828387ca8cb741302eefc44d5e7188b4d1aa87dd Mon Sep 17 00:00:00 2001 From: James Freeman Date: Thu, 3 Mar 2022 07:59:35 +0000 Subject: [PATCH 2/4] fix contract break --- src/Http/Requests/ImportRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/Requests/ImportRequest.php b/src/Http/Requests/ImportRequest.php index 6fb2a7dd..0bebd1a8 100644 --- a/src/Http/Requests/ImportRequest.php +++ b/src/Http/Requests/ImportRequest.php @@ -70,7 +70,7 @@ public function all($keys = null) * @return array * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ - public function validated() + public function validated($key = null, $default = null) { $content = ''; From dc41ef5a2ddbfb6069a8bc0aa55e80e48fe4037f Mon Sep 17 00:00:00 2001 From: James Freeman Date: Thu, 3 Mar 2022 08:10:34 +0000 Subject: [PATCH 3/4] reverted types to get tests to pass --- src/Contracts/TaskInterface.php | 2 +- src/Http/Middleware/Authenticate.php | 2 +- src/Repositories/EloquentTaskRepository.php | 2 +- src/Totem.php | 4 ++-- tests/Feature/TaskExecutionTest.php | 5 ++++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Contracts/TaskInterface.php b/src/Contracts/TaskInterface.php index a34d56f0..c955de24 100644 --- a/src/Contracts/TaskInterface.php +++ b/src/Contracts/TaskInterface.php @@ -21,7 +21,7 @@ public function builder(): Builder; * @param int|Task $id * @return Task */ - public function find(Task|int $id): Task; + public function find(Task|int $id); /** * Returns all tasks. diff --git a/src/Http/Middleware/Authenticate.php b/src/Http/Middleware/Authenticate.php index 713302ec..2da5c375 100644 --- a/src/Http/Middleware/Authenticate.php +++ b/src/Http/Middleware/Authenticate.php @@ -16,7 +16,7 @@ class Authenticate * @param Closure $next * @return Response */ - public function handle(Request $request, Closure $next): Response + public function handle($request, $next) { return Totem::check($request) ? $next($request) : abort(403); } diff --git a/src/Repositories/EloquentTaskRepository.php b/src/Repositories/EloquentTaskRepository.php index eb20e573..cd3a4f7f 100644 --- a/src/Repositories/EloquentTaskRepository.php +++ b/src/Repositories/EloquentTaskRepository.php @@ -48,7 +48,7 @@ public function builder(): Builder * @param int|Task $id * @return Task */ - public function find(Task|int $id): Task + public function find(Task|int $id) { if ($id instanceof Task) { return $id; diff --git a/src/Totem.php b/src/Totem.php index 5a41b84e..93e0ddf3 100644 --- a/src/Totem.php +++ b/src/Totem.php @@ -23,10 +23,10 @@ class Totem /** * Determine if the given request can access the Totem dashboard. * - * @param Request $request + * @param Request|string|null $request * @return bool */ - public static function check(Request $request): bool + public static function check($request): bool { return (static::$authUsing ?: function () { return app()->environment('local'); diff --git a/tests/Feature/TaskExecutionTest.php b/tests/Feature/TaskExecutionTest.php index 7ea97aae..c0422cf6 100644 --- a/tests/Feature/TaskExecutionTest.php +++ b/tests/Feature/TaskExecutionTest.php @@ -43,7 +43,10 @@ public function it_executes_a_scheduled_task() Event::fake(); - $this->get(route('totem.task.execute', $task->id)) + $this->withoutExceptionHandling(); + + $this->signIn() + ->get(route('totem.task.execute', $task->id)) ->assertSuccessful(); $this->assertEquals(1, Result::count()); From 6e0296c220bb9e20aed563015151452e149efbdc Mon Sep 17 00:00:00 2001 From: James Freeman Date: Thu, 3 Mar 2022 08:21:37 +0000 Subject: [PATCH 4/4] remove unneeded element --- tests/Feature/TaskExecutionTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Feature/TaskExecutionTest.php b/tests/Feature/TaskExecutionTest.php index c0422cf6..186a37ec 100644 --- a/tests/Feature/TaskExecutionTest.php +++ b/tests/Feature/TaskExecutionTest.php @@ -43,8 +43,6 @@ public function it_executes_a_scheduled_task() Event::fake(); - $this->withoutExceptionHandling(); - $this->signIn() ->get(route('totem.task.execute', $task->id)) ->assertSuccessful();