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

Adopt PHPUnit attributes #1167

Merged
merged 3 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ CHANGELOG
## Added
- Support for Laravel 12 [\#1164 / duncanmcclean](https://github.com/rebing/graphql-laravel/pull/1164)

## Changed
- Adopted PHPUnit attributes in the test suite [#1167 / duncanmcclean](https://github.com/rebing/graphql-laravel/pull/1167)

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

Expand Down
3 changes: 2 additions & 1 deletion tests/Database/EmptyQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

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

class EmptyQueryTest extends TestCaseDatabase
{
/**
* @dataProvider dataForEmptyQuery
* @param list<mixed> $parameters
*/
#[DataProvider('dataForEmptyQuery')]
public function testEmptyQuery(array $parameters, string $expectedError): void
{
$response = $this->call('GET', '/graphql', $parameters);
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/EnumMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\EnumMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class EnumMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/ExecutionMiddlewareMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\ExecutionMiddlewareMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class ExecutionMiddlewareMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/InputMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\InputMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class InputMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/InterfaceMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\InterfaceMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class InterfaceMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/MiddlewareMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\MiddlewareMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class MiddlewareMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/MutationMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\MutationMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class MutationMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/QueryMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\QueryMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class QueryMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/ScalarMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\ScalarMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class ScalarMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/SchemaConfigMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\SchemaConfigMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class SchemaConfigMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/TypeMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\TypeMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class TypeMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Console/UnionMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types = 1);
namespace Rebing\GraphQL\Tests\Unit\Console;

use PHPUnit\Framework\Attributes\DataProvider;
use Rebing\GraphQL\Console\UnionMakeCommand;
use Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait;
use Rebing\GraphQL\Tests\TestCase;
Expand All @@ -11,9 +12,7 @@ class UnionMakeCommandTest extends TestCase
{
use MakeCommandAssertionTrait;

/**
* @dataProvider dataForMakeCommand
*/
#[DataProvider('dataForMakeCommand')]
public function testCommand(
string $inputName,
string $expectedFilename,
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/GraphQLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use GraphQL\Type\Schema;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Traits\Macroable;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use Rebing\GraphQL\Error\ValidationError;
use Rebing\GraphQL\Exception\SchemaNotFound;
use Rebing\GraphQL\Exception\TypeNotFound;
Expand Down Expand Up @@ -45,9 +46,7 @@ public function testSchemaWithName(): void
self::assertArrayHasKey('Example', $schema->getTypeMap());
}

/**
* @doesNotPerformAssertions
*/
#[DoesNotPerformAssertions]
public function testSchemaIsValidWithInputFieldAliases(): void
{
$schema = GraphQL::buildSchemaFromConfig([
Expand Down
Loading