Skip to content

Commit f9fbf94

Browse files
albanhJamesFreeman
andauthored
Laravel 9 tests and styling fixed (#327)
* allow constraints * fix contract break * reverted types to get tests to pass * remove unneeded element Co-authored-by: James Freeman <me@james-freeman.info>
1 parent 2b16a10 commit f9fbf94

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@
1919
"php": "^8.0.0|^8.1.0",
2020
"ext-json": "*",
2121
"doctrine/dbal": "^3.1",
22-
"illuminate/bus": "^8.11",
23-
"illuminate/console": "^8.11",
24-
"illuminate/contracts": "^8.11",
25-
"illuminate/database": "^8.11",
26-
"illuminate/events": "^8.11",
27-
"illuminate/notifications": "^8.11",
22+
"illuminate/bus": "^8.11|^9.0",
23+
"illuminate/console": "^8.11|^9.0",
24+
"illuminate/contracts": "^8.11|^9.0",
25+
"illuminate/database": "^8.11|^9.0",
26+
"illuminate/events": "^8.11|^9.0",
27+
"illuminate/notifications": "^8.11|^9.0",
2828
"laravelcollective/html": "^6.0"
2929
},
3030
"require-dev": {
3131
"mockery/mockery": "^1.0",
32-
"orchestra/database": "^6.0",
33-
"orchestra/testbench" : "^6.0",
32+
"orchestra/database": "^6.0|^7.0",
33+
"orchestra/testbench" : "^6.0|^7.0",
3434
"phpunit/phpunit": "^9.0"
3535
},
3636
"suggest": {

src/Contracts/TaskInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function builder(): Builder;
2121
* @param int|Task $id
2222
* @return Task
2323
*/
24-
public function find(Task|int $id): Task;
24+
public function find(Task|int $id);
2525

2626
/**
2727
* Returns all tasks.

src/Http/Middleware/Authenticate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Authenticate
1616
* @param Closure $next
1717
* @return Response
1818
*/
19-
public function handle(Request $request, Closure $next): Response
19+
public function handle($request, $next)
2020
{
2121
return Totem::check($request) ? $next($request) : abort(403);
2222
}

src/Http/Requests/ImportRequest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function messages()
5151
*
5252
* @param array|mixed $keys
5353
* @return array
54+
*
5455
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
5556
*/
5657
public function all($keys = null)
@@ -68,9 +69,10 @@ public function all($keys = null)
6869
* Get the validated data from the request.
6970
*
7071
* @return array
72+
*
7173
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
7274
*/
73-
public function validated()
75+
public function validated($key = null, $default = null)
7476
{
7577
$content = '';
7678

@@ -84,7 +86,7 @@ public function validated()
8486
/**
8587
* * Handle a failed validation attempt.
8688
*
87-
* @param Validator $validator
89+
* @param Validator $validator
8890
*/
8991
protected function failedValidation(Validator $validator)
9092
{

src/Repositories/EloquentTaskRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function builder(): Builder
4848
* @param int|Task $id
4949
* @return Task
5050
*/
51-
public function find(Task|int $id): Task
51+
public function find(Task|int $id)
5252
{
5353
if ($id instanceof Task) {
5454
return $id;

src/Totem.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class Totem
2323
/**
2424
* Determine if the given request can access the Totem dashboard.
2525
*
26-
* @param Request $request
26+
* @param Request|string|null $request
2727
* @return bool
2828
*/
29-
public static function check(Request $request): bool
29+
public static function check($request): bool
3030
{
3131
return (static::$authUsing ?: function () {
3232
return app()->environment('local');
@@ -36,8 +36,7 @@ public static function check(Request $request): bool
3636
/**
3737
* Set the callback that should be used to authenticate Totem users.
3838
*
39-
* @param Closure $callback
40-
*
39+
* @param Closure $callback
4140
* @return static
4241
*/
4342
public static function auth(Closure $callback)

tests/Feature/TaskExecutionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public function it_executes_a_scheduled_task()
4343

4444
Event::fake();
4545

46-
$this->get(route('totem.task.execute', $task->id))
46+
$this->signIn()
47+
->get(route('totem.task.execute', $task->id))
4748
->assertSuccessful();
4849

4950
$this->assertEquals(1, Result::count());

0 commit comments

Comments
 (0)