Skip to content

Supports Laravel 12 #1164

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

Merged
merged 20 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ jobs:
fail-fast: false
matrix:
php: [8.1, 8.2, 8.3, 8.4]
laravel: [^10.0, ^11.0]
laravel: [^10.0, ^11.0, ^12.0]
stability: [prefer-lowest, prefer-stable]
exclude:
- php: 8.1
laravel: ^11.0
- php: 8.1
laravel: ^12.0
name: P=${{ matrix.php }} L=${{ matrix.laravel }} ${{ matrix.stability }}
runs-on: ubuntu-latest
env:
Expand All @@ -51,8 +53,6 @@ jobs:
- run: composer remove --dev friendsofphp/php-cs-fixer --no-update
- run: composer remove --dev phpstan/phpstan --no-update
- run: composer require illuminate/contracts:${{ matrix.laravel }} --no-update
- run: composer require illuminate/contracts:9.33 --no-update
if: matrix.laravel == '^9.0' && matrix.stability == 'prefer-lowest'

- name: Get composer cache directory
id: composer-cache
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ CHANGELOG

[Next release](https://github.com/rebing/graphql-laravel/compare/9.7.0...master)

## Added
- Support for Laravel 12 [\#1164 / duncanmcclean](https://github.com/rebing/graphql-laravel/pull/1164)

2024-11-22, 9.7.0
-----------------

Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"require": {
"php": "^8.1",
"ext-json": "*",
"illuminate/contracts": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0",
"illuminate/contracts": "^10.0|^11.0|^12.0",
"illuminate/support": "^10.0|^11.0|^12.0",
"laragraph/utils": "^2.0.1",
"thecodingmachine/safe": "^2.4",
"webonyx/graphql-php": "^15.0.3"
Expand All @@ -46,13 +46,13 @@
"ext-pdo_sqlite": "*",
"fakerphp/faker": "^1.6",
"friendsofphp/php-cs-fixer": "^3",
"larastan/larastan": "^2",
"laravel/framework": "^10.0|^11.0",
"larastan/larastan": "^3",
"laravel/framework": "^10.0|^11.0|^12.0",
"mfn/php-cs-fixer-config": "^2",
"mockery/mockery": "^1.5",
"orchestra/testbench-core": "^8.0|^9.0",
"phpstan/phpstan": "^1",
"phpunit/phpunit": "^10.5.32",
"phpstan/phpstan": "^2",
"orchestra/testbench": "^8.0|^9.0|^10.0",
"phpunit/phpunit": "^10.5.32 || ^11.0",
"thecodingmachine/phpstan-safe-rule": "^1"
},
"autoload": {
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/NoRoutesRegisteredTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class NoRoutesRegisteredTest extends TestCase
{
protected function getEnvironmentSetUp($app): void
{
// Laravel registers routes for local filesystems by default.
// However, for the purpose of this test, we don't want it to register any routes.
$app['config']->set('filesystems.disks.local.serve', false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is this required? The tests work also without this line for me?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ->assertCount() here was asserting that 0 was 1, because of the filesystem route that Laravel 12 is registering.

https://github.com/rebing/graphql-laravel/blob/master/tests/Unit/NoRoutesRegisteredTest.php#L54

Looks like it only happens on the prefer-lowest tests. Testbench 10.0.1 includes the serve parameter in its stubs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯


$app['config']->set('graphql', [
'route' => [],
'schemas' => [
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/RoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class RoutesTest extends TestCase
{
protected function getEnvironmentSetUp($app): void
{
// Laravel registers routes for local filesystems by default.
// However, for the purpose of this test, we don't want it to register any routes.
$app['config']->set('filesystems.disks.local.serve', false);

$app['config']->set('graphql', [
'route' => [
'prefix' => 'graphql_test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\ValidationOfFieldArguments;

use Composer\InstalledVersions;
use Rebing\GraphQL\Tests\TestCase;

class ValidationOfFieldArgumentsTest extends TestCase
Expand Down Expand Up @@ -83,12 +82,6 @@ public function testRulesTakesEffect(): void
],
];

if ($this->orchestraTestbenchCoreVersionBelow('6.17.1.0')) {
$expected['errors'][0]['extensions']['validation']['profile.args.profileId'] = [
'The profile.args.profile id may not be greater than 10.',
];
}

self::assertEquals($expected, $result);
}

Expand Down Expand Up @@ -138,9 +131,4 @@ public function testOnlyApplicableRulesTakesEffect(): void
];
self::assertEquals($expected, $result);
}

private function orchestraTestbenchCoreVersionBelow(string $versionString): bool
{
return InstalledVersions::getVersion('orchestra/testbench-core') < $versionString;
}
}
Loading