How to test Graphql in the Laravel framework

0

I'm creating an application in Laravel 5.6 with Graphql, from this library: link

I was able to generate everything normally, but I'm having a hard time creating unit tests for application.

Any alternative how to test my requests for Graphql from PHPUnit? Laravel brings some special test?

Example of a simple Query of mine that I want to write the test

class ClientQuery extends Query
{
    protected $attributes = [
        'name' => 'ClientQuery',
        'description' => 'A query'
    ];

    public function type()
    {
       return GraphQL::type("Client");
    }

    public function args()
    {
       return [
           'id' => [
                'type' => Type::nonNull(Type::int()),
            ],
       ];
    }

    public function resolve($root, $args, $context, ResolveInfo $info)
    {
     return Client::find($args['id']);
    }
}
    
asked by anonymous 26.05.2018 / 08:50

0 answers