Skip to content

Commit

Permalink
Update tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Jun 11, 2024
1 parent 9e03f4e commit 5ab521c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@
"psr-4": {
"Benchmarks\\": "benchmarks/",
"Tests\\": "tests/"
}
},
"files": [
"vendor/dms/phpunit-arraysubset-asserts/src/ArraySubsetAsserts.php"
]
},
"config": {
"allow-plugins": {
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
]);
$rectorConfig->skip([
__DIR__ . '/src/Tracing/FederatedTracing/Proto', // Generated code
__DIR__ . '/tests/database/migrations', // Does not fit autoloading standards
__DIR__ . '/tests/database/migrations', // Does not fit autoloader standards
__DIR__ . '/tests/LaravelPhpdocAlignmentFixer.php', // Copied from Laravel
CallableThisArrayToAnonymousFunctionRector::class, // Callable in array form is shorter and more efficient
IssetOnPropertyObjectToPropertyExistsRector::class, // isset() is nice when moving towards typed properties
Expand Down
2 changes: 1 addition & 1 deletion src/Async/AsyncDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function manipulateFieldDefinition(DocumentAST &$documentAST, FieldDefini
$parentName = $parentType->name->value;
if ($parentName !== RootType::MUTATION) {
$location = "{$parentName}.{$fieldDefinition->name->value}";
throw new DefinitionException("The @async directive must only be used on fields of the root type mutation, found it on {$location}.");
throw new DefinitionException("The @async directive must only be used on root mutation fields, found it on {$location}.");
}
}
}
1 change: 1 addition & 0 deletions src/Pagination/PaginationManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ private function maybeInheritCacheControlDirective(): string
/** If federation v2 is used, add the @shareable directive to the pagination generic types. */
private function maybeAddShareableDirective(): string
{
// Not using Illuminate\Container\Container::getInstance() here as it causes PHPStan issues
if (app()->providerIsLoaded(FederationServiceProvider::class) && FederationHelper::isUsingFederationV2($this->documentAST)) {
return /** @lang GraphQL */ '@shareable';
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Async/AsyncDirectiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function testDispatchesMutationOnCustomQueue(): void
public function testOnlyOnMutations(): void
{
$this->expectExceptionObject(new DefinitionException(
'The @async directive must only be used on fields of the root type mutation, found it on Query.foo.',
'The @async directive must only be used on root mutation fields, found it on Query.foo.',
));
$this->buildSchema(/** @lang GraphQL */ '
type Query {
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Schema/Directives/HideDirectiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Unit\Schema\Directives;

use Illuminate\Container\Container;
use Tests\TestCase;

final class HideDirectiveTest extends TestCase
Expand Down Expand Up @@ -59,7 +60,7 @@ public function testHiddenWhenManuallySettingEnv(): void
}
';

app()->instance('env', 'production');
Container::getInstance()->instance('env', 'production');
$this->graphQL($introspectionQuery)
->assertJsonCount(0, 'data.__schema.queryType.fields');
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Schema/Directives/ShowDirectiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Unit\Schema\Directives;

use Illuminate\Container\Container;
use Tests\TestCase;

final class ShowDirectiveTest extends TestCase
Expand Down Expand Up @@ -59,7 +60,7 @@ public function testShownOnAnotherEnv(): void
}
';

app()->instance('env', 'production');
Container::getInstance()->instance('env', 'production');
$this->graphQL($introspectionQuery)
->assertJsonCount(1, 'data.__schema.queryType.fields')
->assertJsonPath('data.__schema.queryType.fields.0.name', 'hiddenField');
Expand Down

0 comments on commit 5ab521c

Please sign in to comment.