Exemplo n.º 1
0
<?php

use Nuwave\Lighthouse\Tests\Support\GraphQL\Types\UserType;
use Nuwave\Lighthouse\Tests\Support\GraphQL\Queries\UserQuery;
use Nuwave\Lighthouse\Tests\Support\GraphQL\Mutations\UpdateEmailMutation;
GraphQL::schema()->type('userConfig', UserType::class);
GraphQL::schema()->query('userQueryConfig', UserQuery::class);
GraphQL::schema()->mutation('updateEmailConfig', UpdateEmailMutation::class);
 /**
  * Helper function to test a query and the expected response.
  */
 private function assertValidQuery($query, $expected)
 {
     $this->assertEquals(['data' => $expected], GraphQL::execute(StarWarsSchema::build(), $query));
 }
 /**
  * Output fields for mutation.
  *
  * @return array
  */
 protected function outputFields()
 {
     return ['hero' => ['type' => GraphQL::type('hero'), 'resolve' => function ($payload) {
     }]];
 }
Exemplo n.º 4
0
 /**
  * Get instance of dataLoader.
  *
  * @param  string $loader
  * @return \Nuwave\Lighthouse\Support\DataLoader\GraphQLDataLoader
  */
 function dataLoader($loader)
 {
     return GraphQL::dataLoader($loader);
 }
Exemplo n.º 5
0
 /**
  * Type query returns.
  *
  * @return Type
  */
 public function type()
 {
     return GraphQL::type('user');
 }