Skip to content
This repository has been archived by the owner on Feb 10, 2019. It is now read-only.

Testing coverage with GraphQL is always return 0% #384

Open
hoangnkvti opened this issue Sep 18, 2018 · 2 comments
Open

Testing coverage with GraphQL is always return 0% #384

hoangnkvti opened this issue Sep 18, 2018 · 2 comments

Comments

@hoangnkvti
Copy link

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.

@mfn
Copy link

mfn commented Sep 18, 2018

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.

@hoangnkvti
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants