Skip to content

Commit f310c74

Browse files
authored
[9.x] Test on PHP 8.2 (#43910)
* Test on PHP 8.2 * Disable tests to reduce builds * Only stable packages * wip * wip * wip * Fix DatabaseMigrationsTest errors * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Disable Ably tests on PHP 8.2 for now * Re-enable other PHP tests * wip
1 parent e5ffa1b commit f310c74

19 files changed

+126
-13
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ jobs:
3939
strategy:
4040
fail-fast: true
4141
matrix:
42-
php: ['8.0', '8.1']
42+
php: ['8.0', 8.1]
4343
stability: [prefer-lowest, prefer-stable]
44+
include:
45+
- php: 8.2
46+
stability: prefer-stable --ignore-platform-req=php+
4447

4548
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
4649

@@ -107,8 +110,11 @@ jobs:
107110
strategy:
108111
fail-fast: true
109112
matrix:
110-
php: ['8.0', '8.1']
113+
php: ['8.0', 8.1]
111114
stability: [prefer-lowest, prefer-stable]
115+
include:
116+
- php: 8.2
117+
stability: prefer-stable --ignore-platform-req=php+
112118

113119
name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows
114120

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"illuminate/view": "self.version"
8282
},
8383
"require-dev": {
84+
"ably/ably-php": "^1.0",
8485
"aws/aws-sdk-php": "^3.198.1",
8586
"doctrine/dbal": "^2.13.3|^3.1.4",
8687
"fakerphp/faker": "^1.9.2",

src/Illuminate/Http/Client/Response.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ class Response implements ArrayAccess
2727
*/
2828
protected $decoded;
2929

30+
/**
31+
* The request cookies.
32+
*
33+
* @var \GuzzleHttp\Cookie\CookieJar
34+
*/
35+
public $cookies;
36+
37+
/**
38+
* The transfer stats for the request.
39+
*
40+
* \GuzzleHttp\TransferStats|null
41+
*/
42+
public $transferStats;
43+
3044
/**
3145
* Create a new response instance.
3246
*

tests/Broadcasting/AblyBroadcasterTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Illuminate\Tests\Broadcasting;
44

5+
use Ably\AblyRest;
56
use Illuminate\Broadcasting\Broadcasters\AblyBroadcaster;
67
use Illuminate\Http\Request;
78
use Mockery as m;
@@ -19,14 +20,24 @@ class AblyBroadcasterTest extends TestCase
1920

2021
protected function setUp(): void
2122
{
23+
if (phpversion() >= '8.2') {
24+
$this->markTestSkipped('Tests are broken on PHP 8.2');
25+
}
26+
2227
parent::setUp();
2328

24-
$this->ably = m::mock('Ably\AblyRest');
25-
$this->ably->options = (object) ['key' => 'abcd:efgh'];
29+
$this->ably = m::mock(AblyRest::class, ['abcd:efgh']);
2630

2731
$this->broadcaster = m::mock(AblyBroadcaster::class, [$this->ably])->makePartial();
2832
}
2933

34+
protected function tearDown(): void
35+
{
36+
parent::tearDown();
37+
38+
m::close();
39+
}
40+
3041
public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCallbackReturnTrue()
3142
{
3243
$this->broadcaster->channel('test', function () {

tests/Broadcasting/PusherBroadcasterTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ public function testUserAuthenticationForPusher()
178178
protected function getMockRequestWithUserForChannel($channel)
179179
{
180180
$request = m::mock(Request::class);
181-
$request->channel_name = $channel;
182-
$request->socket_id = 'abcd.1234';
181+
$request->shouldReceive('all')->andReturn(['channel_name' => $channel, 'socket_id' => 'abcd.1234']);
183182

184183
$request->shouldReceive('input')
185184
->with('callback', false)
@@ -204,7 +203,7 @@ protected function getMockRequestWithUserForChannel($channel)
204203
protected function getMockRequestWithoutUserForChannel($channel)
205204
{
206205
$request = m::mock(Request::class);
207-
$request->channel_name = $channel;
206+
$request->shouldReceive('all')->andReturn(['channel_name' => $channel]);
208207

209208
$request->shouldReceive('user')
210209
->andReturn(null);

tests/Broadcasting/RedisBroadcasterTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ protected function createConfig()
167167
protected function getMockRequestWithUserForChannel($channel)
168168
{
169169
$request = m::mock(Request::class);
170-
$request->channel_name = $channel;
170+
$request->shouldReceive('all')->andReturn(['channel_name' => $channel]);
171+
$request->shouldReceive('all')->andReturn(['channel_name' => $channel]);
171172

172173
$user = m::mock('User');
173174
$user->shouldReceive('getAuthIdentifierForBroadcasting')
@@ -188,7 +189,7 @@ protected function getMockRequestWithUserForChannel($channel)
188189
protected function getMockRequestWithoutUserForChannel($channel)
189190
{
190191
$request = m::mock(Request::class);
191-
$request->channel_name = $channel;
192+
$request->shouldReceive('all')->andReturn(['channel_name' => $channel]);
192193

193194
$request->shouldReceive('user')
194195
->andReturn(null);

tests/Database/DatabaseEloquentModelTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class DatabaseEloquentModelTest extends TestCase
4646
{
4747
use InteractsWithTime;
4848

49+
protected $encrypter;
50+
4951
protected function tearDown(): void
5052
{
5153
parent::tearDown();

tests/Database/DatabaseQueryBuilderTest.php

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

3030
class DatabaseQueryBuilderTest extends TestCase
3131
{
32+
protected $called;
33+
3234
protected function tearDown(): void
3335
{
3436
m::close();

tests/Database/DatabaseSoftDeletingTraitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ public function testRestoreCancel()
6161
class DatabaseSoftDeletingTraitStub
6262
{
6363
use SoftDeletes;
64+
6465
public $deleted_at;
6566
public $updated_at;
6667
public $timestamps = true;
68+
public $exists = false;
6769

6870
public function newQuery()
6971
{

tests/Foundation/Bootstrap/HandleExceptionsTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
class HandleExceptionsTest extends TestCase
1616
{
17+
protected $app;
18+
protected $config;
19+
protected $handleExceptions;
20+
1721
protected function setUp(): void
1822
{
1923
$this->app = m::mock(Application::setInstance(new Application));

0 commit comments

Comments
 (0)