@@ -270,6 +270,41 @@ public function testGetTypes()
270
270
public function testAddSchema ()
271
271
{
272
272
GraphQL::addSchema ('custom_add ' , [
273
+ 'query ' => [
274
+ 'examplesCustom ' => ExamplesQuery::class
275
+ ],
276
+ 'mutation ' => [
277
+ 'updateExampleCustom ' => UpdateExampleMutation::class
278
+ ],
279
+ 'types ' => [
280
+ CustomExampleType::class
281
+ ]
282
+ ]);
283
+
284
+ $ schemas = GraphQL::getSchemas ();
285
+ $ this ->assertArrayHasKey ('custom_add ' , $ schemas );
286
+ }
287
+
288
+ /**
289
+ * Test merge schema
290
+ *
291
+ * @test
292
+ */
293
+ public function testMergeSchema ()
294
+ {
295
+ GraphQL::addSchema ('custom_add ' , [
296
+ 'query ' => [
297
+ 'examplesCustom ' => ExamplesQuery::class
298
+ ],
299
+ 'mutation ' => [
300
+ 'updateExampleCustom ' => UpdateExampleMutation::class
301
+ ],
302
+ 'types ' => [
303
+ CustomExampleType::class
304
+ ]
305
+ ]);
306
+
307
+ GraphQL::addSchema ('custom_add_another ' , [
273
308
'query ' => [
274
309
'examplesCustom ' => ExamplesQuery::class
275
310
],
@@ -283,6 +318,20 @@ public function testAddSchema()
283
318
284
319
$ schemas = GraphQL::getSchemas ();
285
320
$ this ->assertArrayHasKey ('custom_add ' , $ schemas );
321
+ $ this ->assertArrayHasKey ('custom_add_another ' , $ schemas );
322
+
323
+ GraphQL::addSchema ('custom_add_another ' , [
324
+ 'query ' => [
325
+ 'examplesCustomAnother ' => ExamplesQuery::class
326
+ ]
327
+ ]);
328
+
329
+ $ schemas = GraphQL::getSchemas ();
330
+ $ this ->assertArrayHasKey ('custom_add_another ' , $ schemas );
331
+
332
+ $ querys = $ schemas ['custom_add_another ' ]['query ' ];
333
+ $ this ->assertArrayHasKey ('examplesCustom ' , $ querys );
334
+ $ this ->assertArrayHasKey ('examplesCustomAnother ' , $ querys );
286
335
}
287
336
288
337
/**
0 commit comments