diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab3f4240b8be..83ea21361d1c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,8 +39,11 @@ jobs: strategy: fail-fast: true matrix: - php: ['8.0', '8.1'] + php: ['8.0', 8.1] stability: [prefer-lowest, prefer-stable] + include: + - php: 8.2 + stability: prefer-stable --ignore-platform-req=php+ name: PHP ${{ matrix.php }} - ${{ matrix.stability }} @@ -107,8 +110,11 @@ jobs: strategy: fail-fast: true matrix: - php: ['8.0', '8.1'] + php: ['8.0', 8.1] stability: [prefer-lowest, prefer-stable] + include: + - php: 8.2 + stability: prefer-stable --ignore-platform-req=php+ name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows diff --git a/composer.json b/composer.json index 082e1dee54a6..f82f52bce64d 100644 --- a/composer.json +++ b/composer.json @@ -81,6 +81,7 @@ "illuminate/view": "self.version" }, "require-dev": { + "ably/ably-php": "^1.0", "aws/aws-sdk-php": "^3.198.1", "doctrine/dbal": "^2.13.3|^3.1.4", "fakerphp/faker": "^1.9.2", diff --git a/src/Illuminate/Http/Client/Response.php b/src/Illuminate/Http/Client/Response.php index 39af3de0ce0c..233653617808 100644 --- a/src/Illuminate/Http/Client/Response.php +++ b/src/Illuminate/Http/Client/Response.php @@ -27,6 +27,20 @@ class Response implements ArrayAccess */ protected $decoded; + /** + * The request cookies. + * + * @var \GuzzleHttp\Cookie\CookieJar + */ + public $cookies; + + /** + * The transfer stats for the request. + * + * \GuzzleHttp\TransferStats|null + */ + public $transferStats; + /** * Create a new response instance. * diff --git a/tests/Broadcasting/AblyBroadcasterTest.php b/tests/Broadcasting/AblyBroadcasterTest.php index 74683de0a27b..90da94b5e799 100644 --- a/tests/Broadcasting/AblyBroadcasterTest.php +++ b/tests/Broadcasting/AblyBroadcasterTest.php @@ -2,6 +2,7 @@ namespace Illuminate\Tests\Broadcasting; +use Ably\AblyRest; use Illuminate\Broadcasting\Broadcasters\AblyBroadcaster; use Illuminate\Http\Request; use Mockery as m; @@ -19,14 +20,24 @@ class AblyBroadcasterTest extends TestCase protected function setUp(): void { + if (phpversion() >= '8.2') { + $this->markTestSkipped('Tests are broken on PHP 8.2'); + } + parent::setUp(); - $this->ably = m::mock('Ably\AblyRest'); - $this->ably->options = (object) ['key' => 'abcd:efgh']; + $this->ably = m::mock(AblyRest::class, ['abcd:efgh']); $this->broadcaster = m::mock(AblyBroadcaster::class, [$this->ably])->makePartial(); } + protected function tearDown(): void + { + parent::tearDown(); + + m::close(); + } + public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCallbackReturnTrue() { $this->broadcaster->channel('test', function () { diff --git a/tests/Broadcasting/PusherBroadcasterTest.php b/tests/Broadcasting/PusherBroadcasterTest.php index 64f6fa927179..d00b86d87629 100644 --- a/tests/Broadcasting/PusherBroadcasterTest.php +++ b/tests/Broadcasting/PusherBroadcasterTest.php @@ -178,8 +178,7 @@ public function testUserAuthenticationForPusher() protected function getMockRequestWithUserForChannel($channel) { $request = m::mock(Request::class); - $request->channel_name = $channel; - $request->socket_id = 'abcd.1234'; + $request->shouldReceive('all')->andReturn(['channel_name' => $channel, 'socket_id' => 'abcd.1234']); $request->shouldReceive('input') ->with('callback', false) @@ -204,7 +203,7 @@ protected function getMockRequestWithUserForChannel($channel) protected function getMockRequestWithoutUserForChannel($channel) { $request = m::mock(Request::class); - $request->channel_name = $channel; + $request->shouldReceive('all')->andReturn(['channel_name' => $channel]); $request->shouldReceive('user') ->andReturn(null); diff --git a/tests/Broadcasting/RedisBroadcasterTest.php b/tests/Broadcasting/RedisBroadcasterTest.php index 3345c7c26ef5..7422c5547818 100644 --- a/tests/Broadcasting/RedisBroadcasterTest.php +++ b/tests/Broadcasting/RedisBroadcasterTest.php @@ -167,7 +167,8 @@ protected function createConfig() protected function getMockRequestWithUserForChannel($channel) { $request = m::mock(Request::class); - $request->channel_name = $channel; + $request->shouldReceive('all')->andReturn(['channel_name' => $channel]); + $request->shouldReceive('all')->andReturn(['channel_name' => $channel]); $user = m::mock('User'); $user->shouldReceive('getAuthIdentifierForBroadcasting') @@ -188,7 +189,7 @@ protected function getMockRequestWithUserForChannel($channel) protected function getMockRequestWithoutUserForChannel($channel) { $request = m::mock(Request::class); - $request->channel_name = $channel; + $request->shouldReceive('all')->andReturn(['channel_name' => $channel]); $request->shouldReceive('user') ->andReturn(null); diff --git a/tests/Database/DatabaseEloquentModelTest.php b/tests/Database/DatabaseEloquentModelTest.php index e477dd817ad2..d1140a11d635 100755 --- a/tests/Database/DatabaseEloquentModelTest.php +++ b/tests/Database/DatabaseEloquentModelTest.php @@ -46,6 +46,8 @@ class DatabaseEloquentModelTest extends TestCase { use InteractsWithTime; + protected $encrypter; + protected function tearDown(): void { parent::tearDown(); diff --git a/tests/Database/DatabaseQueryBuilderTest.php b/tests/Database/DatabaseQueryBuilderTest.php index ee892d851170..d7c6ed2dc617 100755 --- a/tests/Database/DatabaseQueryBuilderTest.php +++ b/tests/Database/DatabaseQueryBuilderTest.php @@ -29,6 +29,8 @@ class DatabaseQueryBuilderTest extends TestCase { + protected $called; + protected function tearDown(): void { m::close(); diff --git a/tests/Database/DatabaseSoftDeletingTraitTest.php b/tests/Database/DatabaseSoftDeletingTraitTest.php index 39c2e15153dc..675f186d6e65 100644 --- a/tests/Database/DatabaseSoftDeletingTraitTest.php +++ b/tests/Database/DatabaseSoftDeletingTraitTest.php @@ -61,9 +61,11 @@ public function testRestoreCancel() class DatabaseSoftDeletingTraitStub { use SoftDeletes; + public $deleted_at; public $updated_at; public $timestamps = true; + public $exists = false; public function newQuery() { diff --git a/tests/Foundation/Bootstrap/HandleExceptionsTest.php b/tests/Foundation/Bootstrap/HandleExceptionsTest.php index 9495d8e18901..20079dcda008 100644 --- a/tests/Foundation/Bootstrap/HandleExceptionsTest.php +++ b/tests/Foundation/Bootstrap/HandleExceptionsTest.php @@ -14,6 +14,10 @@ class HandleExceptionsTest extends TestCase { + protected $app; + protected $config; + protected $handleExceptions; + protected function setUp(): void { $this->app = m::mock(Application::setInstance(new Application)); diff --git a/tests/Foundation/Testing/DatabaseMigrationsTest.php b/tests/Foundation/Testing/DatabaseMigrationsTest.php index 7ee91e7e4e25..715c7c2f8851 100644 --- a/tests/Foundation/Testing/DatabaseMigrationsTest.php +++ b/tests/Foundation/Testing/DatabaseMigrationsTest.php @@ -17,7 +17,7 @@ protected function setUp(): void { RefreshDatabaseState::$migrated = false; - $this->traitObject = $this->getMockForTrait(DatabaseMigrations::class, [], '', true, true, true, [ + $this->traitObject = $this->getMockForAbstractClass(DatabaseMigrationsTestMockClass::class, [], '', true, true, true, [ 'artisan', 'beforeApplicationDestroyed', ]); @@ -95,3 +95,14 @@ public function testRefreshTestDatabaseWithDropTypesOption() $refreshTestDatabaseReflection->invoke($this->traitObject); } } + +class DatabaseMigrationsTestMockClass +{ + use DatabaseMigrations; + + public $app; + + public $dropViews = false; + + public $dropTypes = false; +} diff --git a/tests/Foundation/Testing/RefreshDatabaseTest.php b/tests/Foundation/Testing/RefreshDatabaseTest.php index 48eea1c0eb8f..6c3f64978a64 100644 --- a/tests/Foundation/Testing/RefreshDatabaseTest.php +++ b/tests/Foundation/Testing/RefreshDatabaseTest.php @@ -17,7 +17,7 @@ protected function setUp(): void { RefreshDatabaseState::$migrated = false; - $this->traitObject = $this->getMockForTrait(RefreshDatabase::class, [], '', true, true, true, [ + $this->traitObject = $this->getMockForAbstractClass(RefreshDatabaseTestMockClass::class, [], '', true, true, true, [ 'artisan', 'beginDatabaseTransaction', ]); @@ -95,3 +95,14 @@ public function testRefreshTestDatabaseWithDropTypesOption() $refreshTestDatabaseReflection->invoke($this->traitObject); } } + +class RefreshDatabaseTestMockClass +{ + use RefreshDatabase; + + public $app; + + public $dropViews = false; + + public $dropTypes = false; +} diff --git a/tests/Foundation/Testing/Traits/CanConfigureMigrationCommandsTest.php b/tests/Foundation/Testing/Traits/CanConfigureMigrationCommandsTest.php index cb97988ac048..19c7112829df 100644 --- a/tests/Foundation/Testing/Traits/CanConfigureMigrationCommandsTest.php +++ b/tests/Foundation/Testing/Traits/CanConfigureMigrationCommandsTest.php @@ -12,7 +12,7 @@ class CanConfigureMigrationCommandsTest extends TestCase protected function setUp(): void { - $this->traitObject = $this->getObjectForTrait(CanConfigureMigrationCommands::class); + $this->traitObject = $this->getMockForAbstractClass(CanConfigureMigrationCommandsTestMockClass::class); } private function __reflectAndSetupAccessibleForProtectedTraitMethod($methodName) @@ -77,3 +77,12 @@ public function testMigrateFreshUsingWithPropertySets(): void $this->assertEquals($expected, $migrateFreshUsingReflection->invoke($this->traitObject)); } } + +class CanConfigureMigrationCommandsTestMockClass +{ + use CanConfigureMigrationCommands; + + public $dropViews = false; + + public $dropTypes = false; +} diff --git a/tests/Mail/AttachableTest.php b/tests/Mail/AttachableTest.php index 21ae39b9204d..caaa6bac9539 100644 --- a/tests/Mail/AttachableTest.php +++ b/tests/Mail/AttachableTest.php @@ -81,6 +81,8 @@ public function testItCanUtiliseExistingApisOnNonMailBasedResourcesWithArgs() { public $pathArgs; + public $dataArgs; + public function withDataAttachment() { $this->dataArgs = func_get_args(); diff --git a/tests/Queue/DatabaseFailedJobProviderTest.php b/tests/Queue/DatabaseFailedJobProviderTest.php index f843a3da42af..e05b4ab5814c 100644 --- a/tests/Queue/DatabaseFailedJobProviderTest.php +++ b/tests/Queue/DatabaseFailedJobProviderTest.php @@ -61,7 +61,7 @@ public function testCanProperlyLogFailedJob() $uuid = Str::uuid(); - $exception = new Exception(utf8_decode('ÐÑÙ0E\xE2\x�98\xA0World��7B¹!þÿ')); + $exception = new Exception(mb_convert_encoding('ÐÑÙ0E\xE2\x�98\xA0World��7B¹!þÿ', 'ISO-8859-1', 'UTF-8')); $provider = new DatabaseFailedJobProvider($db->getDatabaseManager(), 'default', 'failed_jobs'); $provider->log('database', 'default', json_encode(['uuid' => (string) $uuid]), $exception); diff --git a/tests/Queue/QueueSqsJobTest.php b/tests/Queue/QueueSqsJobTest.php index 105d58749d37..bebe16b8209a 100644 --- a/tests/Queue/QueueSqsJobTest.php +++ b/tests/Queue/QueueSqsJobTest.php @@ -12,6 +12,24 @@ class QueueSqsJobTest extends TestCase { + protected $key; + protected $secret; + protected $service; + protected $region; + protected $account; + protected $queueName; + protected $baseUrl; + protected $releaseDelay; + protected $queueUrl; + protected $mockedSqsClient; + protected $mockedContainer; + protected $mockedJob; + protected $mockedData; + protected $mockedPayload; + protected $mockedMessageId; + protected $mockedReceiptHandle; + protected $mockedJobData; + protected function setUp(): void { $this->key = 'AMAZONSQSKEY'; diff --git a/tests/Queue/QueueSqsQueueTest.php b/tests/Queue/QueueSqsQueueTest.php index 2b8c8d7bc9c2..3886a3f83854 100755 --- a/tests/Queue/QueueSqsQueueTest.php +++ b/tests/Queue/QueueSqsQueueTest.php @@ -13,6 +13,23 @@ class QueueSqsQueueTest extends TestCase { + protected $sqs; + protected $account; + protected $queueName; + protected $baseUrl; + protected $prefix; + protected $queueUrl; + protected $mockedJob; + protected $mockedData; + protected $mockedPayload; + protected $mockedDelay; + protected $mockedMessageId; + protected $mockedReceiptHandle; + protected $mockedSendMessageResponseModel; + protected $mockedReceiveMessageResponseModel; + protected $mockedReceiveEmptyMessageResponseModel; + protected $mockedQueueAttributesResponseModel; + protected function tearDown(): void { m::close(); diff --git a/tests/Queue/QueueWorkerTest.php b/tests/Queue/QueueWorkerTest.php index 8d698fd0c869..d600e5776d6e 100755 --- a/tests/Queue/QueueWorkerTest.php +++ b/tests/Queue/QueueWorkerTest.php @@ -23,6 +23,7 @@ class QueueWorkerTest extends TestCase { public $events; public $exceptionHandler; + public $maintenanceFlags; protected function setUp(): void { diff --git a/tests/Support/SupportTestingEventFakeTest.php b/tests/Support/SupportTestingEventFakeTest.php index 8f6d555ad3ad..fbf7a1ab2738 100644 --- a/tests/Support/SupportTestingEventFakeTest.php +++ b/tests/Support/SupportTestingEventFakeTest.php @@ -11,6 +11,8 @@ class SupportTestingEventFakeTest extends TestCase { + protected $fake; + protected function setUp(): void { parent::setUp();