2
2
3
3
namespace Drupal \Tests \graphql \Kernel ;
4
4
5
- use Drupal \Tests \graphql \Kernel \Schema \AlterableComposableTestSchema ;
6
5
use Drupal \graphql \GraphQL \ResolverRegistry ;
6
+ use Drupal \graphql \Plugin \GraphQL \Schema \AlterableComposableSchema ;
7
7
use Drupal \graphql \Plugin \SchemaExtensionPluginInterface ;
8
8
use Drupal \graphql \Plugin \SchemaExtensionPluginManager ;
9
9
@@ -144,7 +144,7 @@ protected function mockSchema($id, $schema, array $extensions = []): void {
144
144
/** @var \PHPUnit\Framework\MockObject\MockObject $extensionManager */
145
145
$ extensionManager = $ this ->getMockBuilder (SchemaExtensionPluginManager::class)
146
146
->disableOriginalConstructor ()
147
- ->onlyMethods (['getExtensions ' ])
147
+ ->onlyMethods (['getExtensions ' , ' createInstance ' ])
148
148
->getMock ();
149
149
150
150
// Adds extra extension in order to test alter extension data event.
@@ -179,9 +179,12 @@ protected function mockSchema($id, $schema, array $extensions = []): void {
179
179
$ extensionManager ->expects (static ::any ())
180
180
->method ('getExtensions ' )
181
181
->willReturn ($ extensions );
182
+ $ extensionManager ->expects (static ::any ())
183
+ ->method ('createInstance ' )
184
+ ->willReturn ($ extensions ['graphql_alterable_schema_test ' ]);
182
185
183
186
// Replace mock schema with our own implementation.
184
- $ this ->schema = $ this ->getMockBuilder (AlterableComposableTestSchema ::class)
187
+ $ this ->schema = $ this ->getMockBuilder (AlterableComposableSchema ::class)
185
188
->setConstructorArgs ([
186
189
[],
187
190
$ id ,
@@ -192,7 +195,7 @@ protected function mockSchema($id, $schema, array $extensions = []): void {
192
195
['development ' => FALSE ],
193
196
$ this ->container ->get ('event_dispatcher ' ),
194
197
])
195
- ->onlyMethods (['getSchemaDefinition ' , 'getResolverRegistry ' ])
198
+ ->onlyMethods (['getSchemaDefinition ' , 'getResolverRegistry ' , ' getConfiguration ' ])
196
199
->getMock ();
197
200
198
201
$ this ->schema ->expects (static ::any ())
@@ -203,6 +206,9 @@ protected function mockSchema($id, $schema, array $extensions = []): void {
203
206
$ this ->schema ->expects ($ this ->any ())
204
207
->method ('getResolverRegistry ' )
205
208
->willReturn ($ this ->registry );
209
+ $ this ->schema ->expects ($ this ->any ())
210
+ ->method ('getConfiguration ' )
211
+ ->willReturn (['extensions ' => ['graphql_alterable_schema_test ' => 'graphql_alterable_schema_test ' ]]);
206
212
}
207
213
208
214
}
0 commit comments