I am trying to use database and laravel-lighthouse in tests. I am using the traits for GraphQL and Database Testing, mutation works but tests don't.
class MyTest extends TestCase{
use MakesGraphQLRequests;
use RefreshDatabase;
public function testGraphQLDatabaseTest(){
$this->graphQL(/** @lang GraphQL */ '
mutation CreatePost($title: String!) {
createPost(title: $title) {
id
}
}
',['title' => 'test title']);
$this->assertDatabaseHas('posts', [
'title' => 'test title',
]); // It says that expect table posts with title' => 'test title' but 'posts' table is empty
}
}