Skip to content

Commit

Permalink
Use testbench WithConfig attribute to set app.debug
Browse files Browse the repository at this point in the history
This fixes the failing test `testNoExplicitContentType`

We do set it in `\Rebing\GraphQL\Tests\TestCase::getEnvironmentSetUp`
which _is_ executed in the this test, but too late.

By the time `\Illuminate\Foundation\Providers\FoundationServiceProvider::registerExceptionRenderer` is called,
the `getEnvironmentSetUp()` is not yet called and therefore the debug
mode being enabled is not realized.

But other parts in the framework later "see" the enabled debug mode,
and due to this mismatch the framework expects registered classes
which however arent.
  • Loading branch information
mfn committed Jun 4, 2024
1 parent 1d4873c commit 22d0165
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/Database/EmptyQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Rebing\GraphQL\Tests\Database;

use Laragraph\Utils\BadRequestGraphQLException;
use Orchestra\Testbench\Attributes\WithConfig;
use Rebing\GraphQL\Tests\TestCaseDatabase;

class EmptyQueryTest extends TestCaseDatabase
Expand All @@ -23,6 +24,7 @@ public function testEmptyQuery(array $parameters, string $expectedError): void
self::assertSame($expectedError, $result['errors'][0]['message']);
}

#[WithConfig('app.debug', true)]
public function testNoExplicitContentType(): void
{
$response = $this->call('POST', '/graphql', [
Expand Down

0 comments on commit 22d0165

Please sign in to comment.