Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 684a512

Browse files
[9.x] Deprecation Test Improvements (#45317)
* Deprecation test improvements * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip * Update tests.yml * Disable tests for now * Fix test * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * Refactor * Refactor * Refactor Signed-off-by: Mior Muhammad Zaki <[email protected]> Co-authored-by: Dries Vints <[email protected]>
1 parent 52e2229 commit 684a512

21 files changed

+64
-21
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
with:
7474
timeout_minutes: 5
7575
max_attempts: 5
76-
command: composer require ramsey/collection:^1.2 brick/math:^0.9.3 --no-interaction --no-update
76+
command: composer require ramsey/collection:^1.2 brick/math:^0.9.3 symfony/css-selector:^6.0 --no-interaction --no-update
7777
if: matrix.php >= 8.1
7878

7979
- name: Set Minimum PHP 8.2 Versions
@@ -145,12 +145,20 @@ jobs:
145145
command: composer require guzzlehttp/guzzle:~7.2 --no-interaction --no-update
146146
if: matrix.php >= 8
147147

148+
- name: Set Minimum PHP 8.1 Versions
149+
uses: nick-fields/retry@v2
150+
with:
151+
timeout_minutes: 5
152+
max_attempts: 5
153+
command: composer require ramsey/collection:~1.2 brick/math:~0.9.3 symfony/css-selector:~6.0 --no-interaction --no-update
154+
if: matrix.php >= 8.1
155+
148156
- name: Set Minimum PHP 8.2 Versions
149157
uses: nick-fields/retry@v2
150158
with:
151159
timeout_minutes: 5
152160
max_attempts: 5
153-
command: composer require guzzlehttp/guzzle:~7.5 guzzlehttp/psr7:~2.4 predis/predis:^2.0.2 --no-interaction --no-update
161+
command: composer require guzzlehttp/guzzle:~7.5 guzzlehttp/psr7:~2.4 predis/predis:~2.0.2 --no-interaction --no-update
154162
if: matrix.php >= 8.2
155163

156164
- name: Install dependencies

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"egulias/email-validator": "^3.2.1",
2424
"fruitcake/php-cors": "^1.2",
2525
"laravel/serializable-closure": "^1.2.2",
26-
"league/commonmark": "^2.2",
26+
"league/commonmark": "^2.2.1",
2727
"league/flysystem": "^3.8.0",
2828
"monolog/monolog": "^2.0",
2929
"nesbot/carbon": "^2.62.1",
@@ -85,15 +85,15 @@
8585
"ably/ably-php": "^1.0",
8686
"aws/aws-sdk-php": "^3.235.5",
8787
"doctrine/dbal": "^2.13.3|^3.1.4",
88-
"fakerphp/faker": "^1.9.2",
88+
"fakerphp/faker": "^1.21",
8989
"guzzlehttp/guzzle": "^7.5",
9090
"league/flysystem-aws-s3-v3": "^3.0",
9191
"league/flysystem-ftp": "^3.0",
9292
"league/flysystem-path-prefixing": "^3.3",
9393
"league/flysystem-read-only": "^3.3",
9494
"league/flysystem-sftp-v3": "^3.0",
9595
"mockery/mockery": "^1.5.1",
96-
"orchestra/testbench-core": "^7.11",
96+
"orchestra/testbench-core": "^7.16",
9797
"pda/pheanstalk": "^4.0",
9898
"phpstan/phpstan": "^1.4.7",
9999
"phpunit/phpunit": "^9.5.8",

src/Illuminate/Console/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Command extends SymfonyCommand
4242
/**
4343
* The console command description.
4444
*
45-
* @var string
45+
* @var string|null
4646
*/
4747
protected $description;
4848

src/Illuminate/Console/Scheduling/CallbackEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function getSummaryForDisplay()
184184
*/
185185
public function mutexName()
186186
{
187-
return 'framework/schedule-'.sha1($this->description);
187+
return 'framework/schedule-'.sha1($this->description ?? '');
188188
}
189189

190190
/**

src/Illuminate/Console/Scheduling/Event.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Event
2626
/**
2727
* The command string.
2828
*
29-
* @var string
29+
* @var string|null
3030
*/
3131
public $command;
3232

@@ -47,7 +47,7 @@ class Event
4747
/**
4848
* The user the command should run as.
4949
*
50-
* @var string
50+
* @var string|null
5151
*/
5252
public $user;
5353

@@ -138,7 +138,7 @@ class Event
138138
/**
139139
* The human readable description of the event.
140140
*
141-
* @var string
141+
* @var string|null
142142
*/
143143
public $description;
144144

src/Illuminate/Console/Scheduling/ScheduleListCommand.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,20 @@ public function handle(Schedule $schedule)
8080
$events = $events->map(function ($event) use ($terminalWidth, $expressionSpacing, $timezone) {
8181
$expression = $this->formatCronExpression($event->expression, $expressionSpacing);
8282

83-
$command = $event->command;
84-
$description = $event->description;
83+
$command = $event->command ?? '';
84+
85+
$description = $event->description ?? '';
8586

8687
if (! $this->output->isVerbose()) {
8788
$command = str_replace([Application::phpBinary(), Application::artisanBinary()], [
8889
'php',
8990
preg_replace("#['\"]#", '', Application::artisanBinary()),
90-
], $event->command);
91+
], $command);
9192
}
9293

9394
if ($event instanceof CallbackEvent) {
94-
if (class_exists($event->description)) {
95-
$command = $event->description;
95+
if (class_exists($description)) {
96+
$command = $description;
9697
$description = '';
9798
} else {
9899
$command = 'Closure at: '.$this->getClosureLocation($event);
@@ -149,7 +150,7 @@ private function getCronExpressionSpacing($events)
149150
{
150151
$rows = $events->map(fn ($event) => array_map('mb_strlen', preg_split("/\s+/", $event->expression)));
151152

152-
return collect($rows[0] ?? [])->keys()->map(fn ($key) => $rows->max($key));
153+
return collect($rows[0] ?? [])->keys()->map(fn ($key) => $rows->max($key))->all();
153154
}
154155

155156
/**

src/Illuminate/Database/Eloquent/BroadcastableModelEventOccurred.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ class BroadcastableModelEventOccurred implements ShouldBroadcast
4646
*/
4747
public $queue;
4848

49+
/**
50+
* Indicates whether the job should be dispatched after all database transactions have committed.
51+
*
52+
* @var bool|null
53+
*/
54+
public $afterCommit;
55+
4956
/**
5057
* Create a new event instance.
5158
*

src/Illuminate/Database/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
"suggest": {
3838
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).",
39-
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
39+
"fakerphp/faker": "Required to use the eloquent factory builder (^1.21).",
4040
"illuminate/console": "Required to use the database commands (^9.0).",
4141
"illuminate/events": "Required to use the observers with Eloquent (^9.0).",
4242
"illuminate/filesystem": "Required to use the migrations (^9.0).",

src/Illuminate/Foundation/Bootstrap/HandleExceptions.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ public function bootstrap(Application $app)
6868
public function handleError($level, $message, $file = '', $line = 0, $context = [])
6969
{
7070
if ($this->isDeprecation($level)) {
71-
return $this->handleDeprecationError($message, $file, $line, $level);
72-
}
73-
74-
if (error_reporting() & $level) {
71+
$this->handleDeprecationError($message, $file, $line, $level);
72+
} elseif (error_reporting() & $level) {
7573
throw new ErrorException($message, 0, $level, $file, $line);
7674
}
7775
}

src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ class AnonymousResourceCollection extends ResourceCollection
1111
*/
1212
public $collects;
1313

14+
/**
15+
* Indicates if the collection keys should be preserved.
16+
*
17+
* @var bool
18+
*/
19+
public $preserveKeys = false;
20+
1421
/**
1522
* Create a new anonymous resource collection.
1623
*

tests/Integration/Auth/ForgotPasswordTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Notifications\Messages\MailMessage;
77
use Illuminate\Support\Facades\Notification;
88
use Illuminate\Support\Facades\Password;
9+
use Illuminate\Support\Str;
910
use Illuminate\Tests\Integration\Auth\Fixtures\AuthenticationTestUser;
1011
use Orchestra\Testbench\Factories\UserFactory;
1112
use Orchestra\Testbench\TestCase;
@@ -22,6 +23,7 @@ protected function tearDown(): void
2223

2324
protected function defineEnvironment($app)
2425
{
26+
$app['config']->set('app.key', Str::random(32));
2527
$app['config']->set('auth.providers.users.model', AuthenticationTestUser::class);
2628
}
2729

tests/Integration/Auth/ForgotPasswordWithoutDefaultRoutesTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Notifications\Messages\MailMessage;
77
use Illuminate\Support\Facades\Notification;
88
use Illuminate\Support\Facades\Password;
9+
use Illuminate\Support\Str;
910
use Illuminate\Tests\Integration\Auth\Fixtures\AuthenticationTestUser;
1011
use Orchestra\Testbench\Factories\UserFactory;
1112
use Orchestra\Testbench\TestCase;
@@ -22,6 +23,7 @@ protected function tearDown(): void
2223

2324
protected function defineEnvironment($app)
2425
{
26+
$app['config']->set('app.key', Str::random(32));
2527
$app['config']->set('auth.providers.users.model', AuthenticationTestUser::class);
2628
}
2729

tests/Integration/Console/Events/EventListCommandTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
class EventListCommandTest extends TestCase
1212
{
13+
public $dispatcher;
14+
1315
protected function setUp(): void
1416
{
1517
parent::setUp();

tests/Integration/Console/Scheduling/ScheduleListCommandTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
class ScheduleListCommandTest extends TestCase
1313
{
14+
public $schedule;
15+
1416
protected function setUp(): void
1517
{
1618
parent::setUp();

tests/Integration/Console/Scheduling/ScheduleTestCommandTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
class ScheduleTestCommandTest extends TestCase
1313
{
14+
public $schedule;
15+
1416
protected function setUp(): void
1517
{
1618
parent::setUp();

tests/Integration/Database/DatabaseEloquentModelCustomCastingTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ class TestEloquentModelWithCustomCast extends Model
304304

305305
class HashCaster implements CastsInboundAttributes
306306
{
307+
protected $algorithm;
308+
307309
public function __construct($algorithm = 'sha256')
308310
{
309311
$this->algorithm = $algorithm;

tests/Integration/Database/EloquentHasOneOfManyTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
class EloquentHasOneOfManyTest extends DatabaseTestCase
1010
{
11+
public $retrievedLogins;
12+
1113
protected function defineDatabaseMigrationsAfterDatabaseRefreshed()
1214
{
1315
Schema::create('users', function ($table) {

tests/Integration/Migration/MigratorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class MigratorTest extends TestCase
1414
*/
1515
private $output;
1616

17+
public $subject;
18+
1719
protected function setUp(): void
1820
{
1921
parent::setUp();

tests/Integration/Notifications/SendingMailNotificationsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
class SendingMailNotificationsTest extends TestCase
2323
{
24+
public $mailFactory;
2425
public $mailer;
2526
public $markdown;
2627

tests/Integration/Queue/ThrottlesExceptionsWithRedisTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ class CircuitBreakerWithRedisTestJob
129129

130130
public static $handled = false;
131131

132+
public $key;
133+
132134
public function __construct($key)
133135
{
134136
$this->key = $key;
@@ -153,6 +155,8 @@ class CircuitBreakerWithRedisSuccessfulJob
153155

154156
public static $handled = false;
155157

158+
public $key;
159+
156160
public function __construct($key)
157161
{
158162
$this->key = $key;

tests/Integration/Routing/UrlSigningTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ public function __construct(array $ignore)
286286
class RoutableInterfaceStub implements UrlRoutable
287287
{
288288
public $key;
289+
public $routable;
289290
public $slug = 'routable-slug';
290291

291292
public function getRouteKey()

0 commit comments

Comments
 (0)