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

Supports Laravel 12 #125

Merged
merged 22 commits into from
Feb 13, 2025
41 changes: 35 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
php: [7.1, 7.2, 7.3, 7.4, '8.0', 8.1, 8.2, 8.3]
laravel: [5.8.*, 6.*, 7.*, 8.*, 9.*, 10.*, 11.*]
php: [7.1, 7.2, 7.3, 7.4, '8.0', 8.1, 8.2, 8.3, 8.4]
laravel: [5.8.*, 6.*, 7.*, 8.*, 9.*, 10.*, 11.*, 12.*]
os: [ubuntu-latest]
include:
- laravel: 12.*
testbench: 10.*
- laravel: 11.*
testbench: 9.*
dbal: 3.*
- laravel: 10.*
testbench: 8.*
dbal: 3.*
Expand Down Expand Up @@ -47,6 +49,8 @@ jobs:
php: 8.2
- laravel: 5.8.*
php: 8.3
- laravel: 5.8.*
php: 8.4
- laravel: 6.*
php: 7.1
- laravel: 6.*
Expand All @@ -55,6 +59,8 @@ jobs:
php: 8.2
- laravel: 6.*
php: 8.3
- laravel: 6.*
php: 8.4
- laravel: 7.*
php: 7.1
- laravel: 7.*
Expand All @@ -63,6 +69,8 @@ jobs:
php: 8.2
- laravel: 7.*
php: 8.3
- laravel: 7.*
php: 8.4
- laravel: 8.*
php: 7.1
- laravel: 8.*
Expand All @@ -71,6 +79,8 @@ jobs:
php: 8.2
- laravel: 8.*
php: 8.3
- laravel: 8.*
php: 8.4
- laravel: 9.*
php: 7.1
- laravel: 9.*
Expand All @@ -79,6 +89,8 @@ jobs:
php: 7.3
- laravel: 9.*
php: 7.4
- laravel: 9.*
php: 8.4
- laravel: 10.*
php: 7.1
- laravel: 10.*
Expand All @@ -89,6 +101,8 @@ jobs:
php: 7.4
- laravel: 10.*
php: '8.0'
- laravel: 10.*
php: 8.4
- laravel: 11.*
php: 7.1
- laravel: 11.*
Expand All @@ -101,6 +115,18 @@ jobs:
php: '8.0'
- laravel: 11.*
php: '8.1'
- laravel: 12.*
php: 7.1
- laravel: 12.*
php: 7.2
- laravel: 12.*
php: 7.3
- laravel: 12.*
php: 7.4
- laravel: 12.*
php: '8.0'
- laravel: 12.*
php: '8.1'

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

Expand All @@ -115,11 +141,14 @@ jobs:
extension: mbstring, pdo, pdo_sqlite
coverage: none

- name: Install dependencies
- name: Require DBAL
run: |
composer require "illuminate/contracts:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "doctrine/dbal:${{ matrix.dbal }}" --dev --no-interaction --no-update
composer install --prefer-dist --no-interaction --no-suggest
if: matrix.dbal

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-suggest --with="orchestra/testbench:${{ matrix.testbench }}" --with="illuminate/support:${{ matrix.laravel }}"

- name: Installed dependencies
run: composer show -D
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"php": "^7.1.3|^8.0",
"ext-pdo_sqlite": "*",
"ext-sqlite3": "*",
"illuminate/database": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0",
"illuminate/support": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0"
"illuminate/database": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0",
"illuminate/support": "^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0"
},
"require-dev": {
"doctrine/dbal": "^2.9 || ^3.1.4",
"orchestra/testbench": "3.8.* || 3.9.* || ^4.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^7.5 || ^8.4 || ^9.0 || ^10.0"
"orchestra/testbench": "3.8.* || 3.9.* || ^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
"phpunit/phpunit": "^7.5 || ^8.4 || ^9.0 || ^10.0 || ^11.0"
},
"autoload": {
"psr-4": {
Expand Down
21 changes: 18 additions & 3 deletions tests/SushiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Illuminate\Support\Facades\Validator;
use Orchestra\Testbench\TestCase;

use function Orchestra\Testbench\laravel_version_compare;

class SushiTest extends TestCase
{
public $cachePath;
Expand Down Expand Up @@ -56,7 +58,10 @@ function columns_with_varying_types()
$this->assertEquals('integer', $connectionBuilder->getColumnType('model_with_varying_type_columns', 'int'));
$this->assertEquals('float', $connectionBuilder->getColumnType('model_with_varying_type_columns', 'float'));
$this->assertEquals('datetime', $connectionBuilder->getColumnType('model_with_varying_type_columns', 'dateTime'));
$this->assertEquals('string', $connectionBuilder->getColumnType('model_with_varying_type_columns', 'string'));
$this->assertEquals(
function_exists('\Orchestra\Testbench\laravel_version_compare') && laravel_version_compare('11.0.0', '>=') ? 'varchar' : 'string',
$connectionBuilder->getColumnType('model_with_varying_type_columns', 'string')
);
$this->assertEquals(null, $row->null);
}

Expand All @@ -65,8 +70,14 @@ function model_with_custom_schema()
{
ModelWithCustomSchema::count();
$connectionBuilder = ModelWithCustomSchema::resolveConnection()->getSchemaBuilder();
$this->assertEquals('string', $connectionBuilder->getColumnType('model_with_custom_schemas', 'float'));
$this->assertEquals('string', $connectionBuilder->getColumnType('model_with_custom_schemas', 'string'));
$this->assertEquals(
function_exists('\Orchestra\Testbench\laravel_version_compare') && laravel_version_compare('11.0.0', '>=') ? 'varchar' : 'string',
$connectionBuilder->getColumnType('model_with_custom_schemas', 'float')
);
$this->assertEquals(
function_exists('\Orchestra\Testbench\laravel_version_compare') && laravel_version_compare('11.0.0', '>=') ? 'varchar' : 'string',
$connectionBuilder->getColumnType('model_with_custom_schemas', 'string')
);
}

/** @test */
Expand Down Expand Up @@ -187,6 +198,10 @@ public function it_runs_method_after_migration_when_defined()
* */
function sushi_models_can_relate_to_models_in_regular_sqlite_databases()
{
if (! trait_exists('\Orchestra\Testbench\Concerns\HandlesAnnotations')) {
$this->markTestSkipped('Requires HandlesAnnotation trait to define sqlite connection using PHPUnit annotation');
}

$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
$this->artisan('migrate', ['--database' => 'testbench-sqlite'])->run();

Expand Down
Loading