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 35 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/tests.yml
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
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
13 changes: 9 additions & 4 deletions src/Illuminate/Console/Scheduling/ScheduleListCommand.php
Expand Up @@ -80,26 +80,29 @@ public function handle(Schedule $schedule)
$events = $events->map(function ($event) use ($terminalWidth, $expressionSpacing, $timezone) {
$expression = $this->formatCronExpression($event->expression, $expressionSpacing);

/** @var string|null $command */
$command = $event->command;

/** @var string|null $description */
$description = $event->description;

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

if ($event instanceof CallbackEvent) {
if (class_exists($event->description)) {
if (is_string($event->description) && class_exists($event->description)) {
$command = $event->description;
$description = '';
} else {
$command = 'Closure at: '.$this->getClosureLocation($event);
}
}

$command = mb_strlen($command) > 1 ? "{$command} " : '';
$command = is_string($command) && mb_strlen($command) > 1 ? "{$command} " : '';

$nextDueDateLabel = 'Next Due:';

Expand All @@ -109,7 +112,9 @@ public function handle(Schedule $schedule)
? $nextDueDate->format('Y-m-d H:i:s P')
: $nextDueDate->diffForHumans();

$hasMutex = $event->mutex->exists($event) ? 'Has Mutex › ' : '';
$hasMutex = $event instanceof CallbackEvent
? (is_string($event->description) && $event->mutex->exists($event) ? 'Has Mutex › ' : '')
: ($event->mutex->exists($event) ? 'Has Mutex › ' : '');
driesvints marked this conversation as resolved.
Show resolved Hide resolved

$dots = str_repeat('.', max(
$terminalWidth - mb_strlen($expression.$command.$nextDueDateLabel.$nextDueDate.$hasMutex) - 8, 0
Expand Down
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
6 changes: 2 additions & 4 deletions src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
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
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Http\Resources\Json;

#[\AllowDynamicProperties]
crynobone marked this conversation as resolved.
Show resolved Hide resolved
class AnonymousResourceCollection extends ResourceCollection
{
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Auth/ForgotPasswordTest.php
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
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
Expand Up @@ -10,6 +10,8 @@

class EventListCommandTest extends TestCase
{
public $dispatcher;

protected function setUp(): void
{
parent::setUp();
Expand Down
Expand Up @@ -11,6 +11,8 @@

class ScheduleListCommandTest extends TestCase
{
public $schedule;

protected function setUp(): void
{
parent::setUp();
Expand Down
Expand Up @@ -11,6 +11,8 @@

class ScheduleTestCommandTest extends TestCase
{
public $schedule;

protected function setUp(): void
{
parent::setUp();
Expand Down
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
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
Expand Up @@ -14,6 +14,8 @@ class MigratorTest extends TestCase
*/
private $output;

public $subject;

protected function setUp(): void
{
parent::setUp();
Expand Down
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
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
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