Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Deprecation Test Improvements #45317

Merged
merged 38 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer require ramsey/collection:^1.2 brick/math:^0.9.3 --no-interaction --no-update
command: composer require ramsey/collection:^1.2 brick/math:^0.9.3 symfony/css-selector:^6.0 --no-interaction --no-update
driesvints marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.php >= 8.1

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

- name: Set Minimum PHP 8.1 Versions
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer require ramsey/collection:~1.2 brick/math:~0.9.3 symfony/css-selector:~6.0 --no-interaction --no-update
if: matrix.php >= 8.1

- name: Set Minimum PHP 8.2 Versions
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer require guzzlehttp/guzzle:~7.5 guzzlehttp/psr7:~2.4 predis/predis:^2.0.2 --no-interaction --no-update
command: composer require guzzlehttp/guzzle:~7.5 guzzlehttp/psr7:~2.4 predis/predis:~2.0.2 --no-interaction --no-update
if: matrix.php >= 8.2
driesvints marked this conversation as resolved.
Show resolved Hide resolved

- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"egulias/email-validator": "^3.2.1",
"fruitcake/php-cors": "^1.2",
"laravel/serializable-closure": "^1.2.2",
"league/commonmark": "^2.2",
"league/commonmark": "^2.2.1",
"league/flysystem": "^3.8.0",
"monolog/monolog": "^2.0",
"nesbot/carbon": "^2.62.1",
Expand Down Expand Up @@ -85,15 +85,15 @@
"ably/ably-php": "^1.0",
"aws/aws-sdk-php": "^3.235.5",
"doctrine/dbal": "^2.13.3|^3.1.4",
"fakerphp/faker": "^1.9.2",
"fakerphp/faker": "^1.21",
"guzzlehttp/guzzle": "^7.5",
"league/flysystem-aws-s3-v3": "^3.0",
"league/flysystem-ftp": "^3.0",
"league/flysystem-path-prefixing": "^3.3",
"league/flysystem-read-only": "^3.3",
"league/flysystem-sftp-v3": "^3.0",
"mockery/mockery": "^1.5.1",
"orchestra/testbench-core": "^7.11",
"orchestra/testbench-core": "^7.16",
"pda/pheanstalk": "^4.0",
"phpstan/phpstan": "^1.4.7",
"phpunit/phpunit": "^9.5.8",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Command extends SymfonyCommand
/**
* The console command description.
*
* @var string
* @var string|null
*/
protected $description;

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Scheduling/CallbackEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function getSummaryForDisplay()
*/
public function mutexName()
{
return 'framework/schedule-'.sha1($this->description);
return 'framework/schedule-'.sha1($this->description ?? '');
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Console/Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Event
/**
* The command string.
*
* @var string
* @var string|null
*/
public $command;

Expand All @@ -47,7 +47,7 @@ class Event
/**
* The user the command should run as.
*
* @var string
* @var string|null
*/
public $user;

Expand Down Expand Up @@ -138,7 +138,7 @@ class Event
/**
* The human readable description of the event.
*
* @var string
* @var string|null
*/
public $description;

Expand Down
13 changes: 7 additions & 6 deletions src/Illuminate/Console/Scheduling/ScheduleListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,20 @@ public function handle(Schedule $schedule)
$events = $events->map(function ($event) use ($terminalWidth, $expressionSpacing, $timezone) {
$expression = $this->formatCronExpression($event->expression, $expressionSpacing);

$command = $event->command;
$description = $event->description;
$command = $event->command ?? '';

$description = $event->description ?? '';

if (! $this->output->isVerbose()) {
$command = str_replace([Application::phpBinary(), Application::artisanBinary()], [
'php',
preg_replace("#['\"]#", '', Application::artisanBinary()),
], $event->command);
], $command);
}

if ($event instanceof CallbackEvent) {
if (class_exists($event->description)) {
$command = $event->description;
if (class_exists($description)) {
$command = $description;
$description = '';
} else {
$command = 'Closure at: '.$this->getClosureLocation($event);
Expand Down Expand Up @@ -149,7 +150,7 @@ private function getCronExpressionSpacing($events)
{
$rows = $events->map(fn ($event) => array_map('mb_strlen', preg_split("/\s+/", $event->expression)));

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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class BroadcastableModelEventOccurred implements ShouldBroadcast
*/
public $queue;

/**
* Indicates whether the job should be dispatched after all database transactions have committed.
*
* @var bool|null
*/
public $afterCommit;

/**
* Create a new event instance.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"suggest": {
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).",
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
"fakerphp/faker": "Required to use the eloquent factory builder (^1.21).",
"illuminate/console": "Required to use the database commands (^9.0).",
"illuminate/events": "Required to use the observers with Eloquent (^9.0).",
"illuminate/filesystem": "Required to use the migrations (^9.0).",
Expand Down
6 changes: 2 additions & 4 deletions src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ public function bootstrap(Application $app)
public function handleError($level, $message, $file = '', $line = 0, $context = [])
{
if ($this->isDeprecation($level)) {
return $this->handleDeprecationError($message, $file, $line, $level);
}

if (error_reporting() & $level) {
$this->handleDeprecationError($message, $file, $line, $level);
} elseif (error_reporting() & $level) {
throw new ErrorException($message, 0, $level, $file, $line);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ class AnonymousResourceCollection extends ResourceCollection
*/
public $collects;

/**
* Indicates if the collection keys should be preserved.
*
* @var bool
*/
public $preserveKeys = false;

/**
* Create a new anonymous resource collection.
*
Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Auth/ForgotPasswordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Tests\Integration\Auth\Fixtures\AuthenticationTestUser;
use Orchestra\Testbench\Factories\UserFactory;
use Orchestra\Testbench\TestCase;
Expand All @@ -22,6 +23,7 @@ protected function tearDown(): void

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Tests\Integration\Auth\Fixtures\AuthenticationTestUser;
use Orchestra\Testbench\Factories\UserFactory;
use Orchestra\Testbench\TestCase;
Expand All @@ -22,6 +23,7 @@ protected function tearDown(): void

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

Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Console/Events/EventListCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

class EventListCommandTest extends TestCase
{
public $dispatcher;

protected function setUp(): void
{
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

class ScheduleListCommandTest extends TestCase
{
public $schedule;

protected function setUp(): void
{
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

class ScheduleTestCommandTest extends TestCase
{
public $schedule;

protected function setUp(): void
{
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ class TestEloquentModelWithCustomCast extends Model

class HashCaster implements CastsInboundAttributes
{
protected $algorithm;

public function __construct($algorithm = 'sha256')
{
$this->algorithm = $algorithm;
Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Database/EloquentHasOneOfManyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class EloquentHasOneOfManyTest extends DatabaseTestCase
{
public $retrievedLogins;

protected function defineDatabaseMigrationsAfterDatabaseRefreshed()
{
Schema::create('users', function ($table) {
Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Migration/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class MigratorTest extends TestCase
*/
private $output;

public $subject;

protected function setUp(): void
{
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

class SendingMailNotificationsTest extends TestCase
{
public $mailFactory;
public $mailer;
public $markdown;

Expand Down
4 changes: 4 additions & 0 deletions tests/Integration/Queue/ThrottlesExceptionsWithRedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class CircuitBreakerWithRedisTestJob

public static $handled = false;

public $key;

public function __construct($key)
{
$this->key = $key;
Expand All @@ -153,6 +155,8 @@ class CircuitBreakerWithRedisSuccessfulJob

public static $handled = false;

public $key;

public function __construct($key)
{
$this->key = $key;
Expand Down
1 change: 1 addition & 0 deletions tests/Integration/Routing/UrlSigningTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public function __construct(array $ignore)
class RoutableInterfaceStub implements UrlRoutable
{
public $key;
public $routable;
public $slug = 'routable-slug';

public function getRouteKey()
Expand Down