Skip to content

Commit b05eed0

Browse files
committed
Adding failing test
1 parent df74e32 commit b05eed0

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

Tests/Fixtures/Entities/Contact.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,23 @@ public function injectService(TestGraphqlController $testService = null, stdClas
4747
}
4848
return 'OK';
4949
}
50+
51+
/**
52+
* @Field(prefetchMethod="prefetchData")
53+
*/
54+
public function injectServicePrefetch($prefetchData): string
55+
{
56+
return $prefetchData;
57+
}
58+
59+
/**
60+
* @Autowire(for="$someOtherService", identifier="someOtherService")
61+
*/
62+
public function prefetchData(iterable $iterable, stdClass $someOtherService = null)
63+
{
64+
if ($someOtherService === null) {
65+
return 'KO';
66+
}
67+
return 'OK';
68+
}
5069
}

Tests/Fixtures/config/services.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ services:
2323
someAlias:
2424
alias: someService
2525

26+
someOtherService:
27+
class: stdClass
28+
2629
Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler:
2730
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler
2831
# controllers are imported separately to make sure services can be injected

Tests/FunctionalTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public function testServiceAutowiring(): void
8585
{
8686
contact {
8787
injectService
88+
injectServicePrefetch
8889
}
8990
}']);
9091

@@ -96,6 +97,7 @@ public function testServiceAutowiring(): void
9697
'data' => [
9798
'contact' => [
9899
'injectService' => 'OK',
100+
'injectServicePrefetch' => 'OK',
99101
]
100102
]
101103
], $result);

0 commit comments

Comments
 (0)