Skip to content

Commit e3f2540

Browse files
committed
Normalize GraphQL test strings to nowdoc/heredoc
1 parent 7b75080 commit e3f2540

File tree

173 files changed

+4133
-4085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+4133
-4085
lines changed

tests/Console/UnionDirective.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ final class UnionDirective extends BaseDirective implements Directive
1010
public static function definition(): string
1111
{
1212
return /** @lang GraphQL */ <<<'GRAPHQL'
13-
"""
14-
Some other definition then the original.
15-
"""
16-
directive @union on UNION
17-
GRAPHQL;
13+
"""
14+
Some other definition then the original.
15+
"""
16+
directive @union on UNION
17+
GRAPHQL;
1818
}
1919
}

tests/Console/ValidateSchemaCommandTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ final class ValidateSchemaCommandTest extends TestCase
1010
{
1111
public function testValidatesCorrectSchema(): void
1212
{
13-
$this->schema = /** @lang GraphQL */ '
13+
$this->schema = /** @lang GraphQL */ <<<'GRAPHQL'
1414
type Query {
1515
foo(
1616
arg: ID @eq
1717
): ID @guard
1818
}
19-
';
19+
GRAPHQL;
2020
$tester = $this->commandTester(new ValidateSchemaCommand());
2121
$tester->execute([]);
2222

@@ -25,11 +25,11 @@ public function testValidatesCorrectSchema(): void
2525

2626
public function testFailsValidationUnknownDirective(): void
2727
{
28-
$this->schema = /** @lang GraphQL */ '
28+
$this->schema = /** @lang GraphQL */ <<<'GRAPHQL'
2929
type Query {
3030
foo: ID @unknown
3131
}
32-
';
32+
GRAPHQL;
3333
$tester = $this->commandTester(new ValidateSchemaCommand());
3434

3535
$this->expectException(DirectiveException::class);
@@ -42,11 +42,11 @@ public function testFailsValidationDirectiveInWrongLocation(): void
4242
$this->markTestSkipped('This validation needs to be in the upstream webonyx/graphql-php validation');
4343

4444
// @phpstan-ignore-next-line https://github.com/phpstan/phpstan-phpunit/issues/52
45-
$this->schema = /** @lang GraphQL */ '
45+
$this->schema = /** @lang GraphQL */ <<<'GRAPHQL'
4646
type Query @field {
4747
foo: ID @eq
4848
}
49-
';
49+
GRAPHQL;
5050
$tester = $this->commandTester(new ValidateSchemaCommand());
5151
$tester->execute([]);
5252

tests/Integration/Async/AsyncDirectiveTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ public function testDispatchesMutation(): void
1616
{
1717
$this->mockResolver(static fn (mixed $root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo) => null);
1818

19-
$this->schema .= /** @lang GraphQL */ '
19+
$this->schema .= /** @lang GraphQL */ <<<'GRAPHQL'
2020
type Mutation {
2121
fooAsync: Boolean! @mock @async
2222
}
23-
';
23+
GRAPHQL;
2424

2525
$queue = Queue::fake();
26-
$this->graphQL(/** @lang GraphQL */ '
26+
$this->graphQL(/** @lang GraphQL */ <<<'GRAPHQL'
2727
mutation {
2828
fooAsync
2929
}
30-
')->assertExactJson([
30+
GRAPHQL)->assertExactJson([
3131
'data' => [
3232
'fooAsync' => true,
3333
],
@@ -48,18 +48,18 @@ public function testDispatchesMutationOnCustomQueue(): void
4848
{
4949
$this->mockResolver(static fn (mixed $root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo) => null);
5050

51-
$this->schema .= /** @lang GraphQL */ '
51+
$this->schema .= /** @lang GraphQL */ <<<'GRAPHQL'
5252
type Mutation {
5353
fooAsync: Boolean! @mock @async(queue: "custom")
5454
}
55-
';
55+
GRAPHQL;
5656

5757
$queue = Queue::fake();
58-
$this->graphQL(/** @lang GraphQL */ '
58+
$this->graphQL(/** @lang GraphQL */ <<<'GRAPHQL'
5959
mutation {
6060
fooAsync
6161
}
62-
')->assertExactJson([
62+
GRAPHQL)->assertExactJson([
6363
'data' => [
6464
'fooAsync' => true,
6565
],
@@ -82,10 +82,10 @@ public function testOnlyOnMutations(): void
8282
$this->expectExceptionObject(new DefinitionException(
8383
'The @async directive must only be used on root mutation fields, found it on Query.foo.',
8484
));
85-
$this->buildSchema(/** @lang GraphQL */ '
85+
$this->buildSchema(/** @lang GraphQL */ <<<'GRAPHQL'
8686
type Query {
8787
foo: Boolean! @async
8888
}
89-
');
89+
GRAPHQL);
9090
}
9191
}

0 commit comments

Comments
 (0)