You are here

public function RecursiveTypeTest::testRecursiveType in GraphQL 8.3

Test if the schema is created properly.

File

tests/src/Kernel/Extension/RecursiveTypeTest.php, line 21

Class

RecursiveTypeTest
Test plugin based schema generation.

Namespace

Drupal\Tests\graphql\Kernel\Extension

Code

public function testRecursiveType() {
  $vehicles = [
    [
      'type' => 'Car',
      'backupCar' => [
        'type' => 'Car',
        'engine' => 'electric',
      ],
    ],
  ];
  $prophecy = $this
    ->prophesize(GarageInterface::class);
  $prophecy
    ->getVehicles()
    ->willReturn($vehicles);
  $this->container
    ->set('graphql_test.garage', $prophecy
    ->reveal());
  $query = $this
    ->getQueryFromFile('recursive_garage.gql');
  $this
    ->assertResults($query, [], [
    'garage' => [
      0 => [
        'backupCar' => [
          'engine' => 'electric',
        ],
      ],
    ],
  ], $this
    ->defaultCacheMetaData());
}