Skip to content

Commit bf18497

Browse files
authored
Supports Laravel 12 (#125)
* Supports Laravel 12 * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update SushiTest.php
1 parent 01dd34f commit bf18497

File tree

3 files changed

+57
-13
lines changed

3 files changed

+57
-13
lines changed

.github/workflows/tests.yml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313

1414
strategy:
15+
fail-fast: false
1516
matrix:
16-
php: [7.1, 7.2, 7.3, 7.4, '8.0', 8.1, 8.2, 8.3]
17-
laravel: [5.8.*, 6.*, 7.*, 8.*, 9.*, 10.*, 11.*]
17+
php: [7.1, 7.2, 7.3, 7.4, '8.0', 8.1, 8.2, 8.3, 8.4]
18+
laravel: [5.8.*, 6.*, 7.*, 8.*, 9.*, 10.*, 11.*, 12.*]
1819
os: [ubuntu-latest]
1920
include:
21+
- laravel: 12.*
22+
testbench: 10.*
2023
- laravel: 11.*
2124
testbench: 9.*
22-
dbal: 3.*
2325
- laravel: 10.*
2426
testbench: 8.*
2527
dbal: 3.*
@@ -47,6 +49,8 @@ jobs:
4749
php: 8.2
4850
- laravel: 5.8.*
4951
php: 8.3
52+
- laravel: 5.8.*
53+
php: 8.4
5054
- laravel: 6.*
5155
php: 7.1
5256
- laravel: 6.*
@@ -55,6 +59,8 @@ jobs:
5559
php: 8.2
5660
- laravel: 6.*
5761
php: 8.3
62+
- laravel: 6.*
63+
php: 8.4
5864
- laravel: 7.*
5965
php: 7.1
6066
- laravel: 7.*
@@ -63,6 +69,8 @@ jobs:
6369
php: 8.2
6470
- laravel: 7.*
6571
php: 8.3
72+
- laravel: 7.*
73+
php: 8.4
6674
- laravel: 8.*
6775
php: 7.1
6876
- laravel: 8.*
@@ -71,6 +79,8 @@ jobs:
7179
php: 8.2
7280
- laravel: 8.*
7381
php: 8.3
82+
- laravel: 8.*
83+
php: 8.4
7484
- laravel: 9.*
7585
php: 7.1
7686
- laravel: 9.*
@@ -79,6 +89,8 @@ jobs:
7989
php: 7.3
8090
- laravel: 9.*
8191
php: 7.4
92+
- laravel: 9.*
93+
php: 8.4
8294
- laravel: 10.*
8395
php: 7.1
8496
- laravel: 10.*
@@ -89,6 +101,8 @@ jobs:
89101
php: 7.4
90102
- laravel: 10.*
91103
php: '8.0'
104+
- laravel: 10.*
105+
php: 8.4
92106
- laravel: 11.*
93107
php: 7.1
94108
- laravel: 11.*
@@ -101,6 +115,18 @@ jobs:
101115
php: '8.0'
102116
- laravel: 11.*
103117
php: '8.1'
118+
- laravel: 12.*
119+
php: 7.1
120+
- laravel: 12.*
121+
php: 7.2
122+
- laravel: 12.*
123+
php: 7.3
124+
- laravel: 12.*
125+
php: 7.4
126+
- laravel: 12.*
127+
php: '8.0'
128+
- laravel: 12.*
129+
php: '8.1'
104130

105131
name: PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }}
106132

@@ -115,11 +141,14 @@ jobs:
115141
extension: mbstring, pdo, pdo_sqlite
116142
coverage: none
117143

118-
- name: Install dependencies
144+
- name: Require DBAL
119145
run: |
120-
composer require "illuminate/contracts:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
121146
composer require "doctrine/dbal:${{ matrix.dbal }}" --dev --no-interaction --no-update
122-
composer install --prefer-dist --no-interaction --no-suggest
147+
if: matrix.dbal
148+
149+
- name: Install dependencies
150+
run: |
151+
composer update --prefer-dist --no-interaction --no-suggest --with="orchestra/testbench:${{ matrix.testbench }}" --with="illuminate/support:${{ matrix.laravel }}"
123152
124153
- name: Installed dependencies
125154
run: composer show -D

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
"php": "^7.1.3|^8.0",
1313
"ext-pdo_sqlite": "*",
1414
"ext-sqlite3": "*",
15-
"illuminate/database": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0",
16-
"illuminate/support": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0"
15+
"illuminate/database": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0",
16+
"illuminate/support": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0"
1717
},
1818
"require-dev": {
1919
"doctrine/dbal": "^2.9 || ^3.1.4",
20-
"orchestra/testbench": "3.8.* || 3.9.* || ^4.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
21-
"phpunit/phpunit": "^7.5 || ^8.4 || ^9.0 || ^10.0"
20+
"orchestra/testbench": "3.8.* || 3.9.* || ^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
21+
"phpunit/phpunit": "^7.5 || ^8.4 || ^9.0 || ^10.0 || ^11.0"
2222
},
2323
"autoload": {
2424
"psr-4": {

tests/SushiTest.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Illuminate\Support\Facades\Validator;
1010
use Orchestra\Testbench\TestCase;
1111

12+
use function Orchestra\Testbench\laravel_version_compare;
13+
1214
class SushiTest extends TestCase
1315
{
1416
public $cachePath;
@@ -56,7 +58,10 @@ function columns_with_varying_types()
5658
$this->assertEquals('integer', $connectionBuilder->getColumnType('model_with_varying_type_columns', 'int'));
5759
$this->assertEquals('float', $connectionBuilder->getColumnType('model_with_varying_type_columns', 'float'));
5860
$this->assertEquals('datetime', $connectionBuilder->getColumnType('model_with_varying_type_columns', 'dateTime'));
59-
$this->assertEquals('string', $connectionBuilder->getColumnType('model_with_varying_type_columns', 'string'));
61+
$this->assertEquals(
62+
function_exists('\Orchestra\Testbench\laravel_version_compare') && laravel_version_compare('11.0.0', '>=') ? 'varchar' : 'string',
63+
$connectionBuilder->getColumnType('model_with_varying_type_columns', 'string')
64+
);
6065
$this->assertEquals(null, $row->null);
6166
}
6267

@@ -65,8 +70,14 @@ function model_with_custom_schema()
6570
{
6671
ModelWithCustomSchema::count();
6772
$connectionBuilder = ModelWithCustomSchema::resolveConnection()->getSchemaBuilder();
68-
$this->assertEquals('string', $connectionBuilder->getColumnType('model_with_custom_schemas', 'float'));
69-
$this->assertEquals('string', $connectionBuilder->getColumnType('model_with_custom_schemas', 'string'));
73+
$this->assertEquals(
74+
function_exists('\Orchestra\Testbench\laravel_version_compare') && laravel_version_compare('11.0.0', '>=') ? 'varchar' : 'string',
75+
$connectionBuilder->getColumnType('model_with_custom_schemas', 'float')
76+
);
77+
$this->assertEquals(
78+
function_exists('\Orchestra\Testbench\laravel_version_compare') && laravel_version_compare('11.0.0', '>=') ? 'varchar' : 'string',
79+
$connectionBuilder->getColumnType('model_with_custom_schemas', 'string')
80+
);
7081
}
7182

7283
/** @test */
@@ -187,6 +198,10 @@ public function it_runs_method_after_migration_when_defined()
187198
* */
188199
function sushi_models_can_relate_to_models_in_regular_sqlite_databases()
189200
{
201+
if (! trait_exists('\Orchestra\Testbench\Concerns\HandlesAnnotations')) {
202+
$this->markTestSkipped('Requires HandlesAnnotation trait to define sqlite connection using PHPUnit annotation');
203+
}
204+
190205
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
191206
$this->artisan('migrate', ['--database' => 'testbench-sqlite'])->run();
192207

0 commit comments

Comments
 (0)