laravel-graphql icon indicating copy to clipboard operation
laravel-graphql copied to clipboard

Testing coverage with GraphQL is always return 0%

Open hoangnkvti opened this issue 7 years ago • 2 comments

Hi,

I want to test my code coverage, so I am using php unit with xdebug.

I have a function like this:

   /**
   * @test
   */
  public function getReturnOk()
  {
      $query = 'query{clients{clname, is_mypage_event}}';
      $response = $this->withoutMiddleware()->get('graphql/secret?query=' . $query);
      $response->assertStatus(Response::HTTP_OK);
  }

But when I execute ./vendor/bin/phpunit --coverage-html coverage, the coverage result is 0%, means that no line was executed

Was my test method wrong??

Thank you so much.

hoangnkvti avatar Sep 18 '18 04:09 hoangnkvti

And your coverage setup is working, in general? For non-GraphQL related stuff?

A project of mine I work on has working coverage also within the GraphQL parts.

mfn avatar Sep 18 '18 06:09 mfn

My coverage is working with normal API. Could you please give me a short example of your test?

hoangnkvti avatar Sep 18 '18 06:09 hoangnkvti