nuwave / lighthouse

A framework for serving GraphQL from Laravel
https://lighthouse-php.com
MIT License
3.33k stars 434 forks source link

Support SQLite during tests #2539

Open jaulz opened 2 months ago

jaulz commented 2 months ago

Changes

This PR allows developers to easily use SQLite during testing without setting up a MySQL database.

Breaking changes

n/a

spawnia commented 2 months ago

What are the steps to actually use SQLite testing? Do all tests pass with it?

jaulz commented 2 months ago

It's quite easy:

Unfortunately, not all tests pass but they help me to develop in an environment (gitpod.io) to quickly iterate on ideas. These tests fail:

There were 3 failures:

1) Tests\Integration\Cache\CacheDirectiveTest::testCacheHasManyResolver
This query should only run once and be cached on the second run.
Failed asserting that 0 is identical to 1.

/workspace/lighthouse/tests/Integration/Cache/CacheDirectiveTest.php:397

2) Tests\Integration\Cache\CacheDirectiveTest::testAttachTagsToCache
This query should only run once and be cached on the second run.
Failed asserting that 0 is identical to 1.

/workspace/lighthouse/tests/Integration/Cache/CacheDirectiveTest.php:467

3) Tests\Integration\Schema\Directives\LikeDirectiveTest::testLikeClientWildcardsAreEscapedFromTemplate
Unable to find JSON fragment: 

[{"users":[{"name":"Aar%on"}]}]

within

[{"data":{"users":[]}}].
Failed asserting that false is true.

/workspace/lighthouse/vendor/laravel/framework/src/Illuminate/Testing/AssertableJsonString.php:142
/workspace/lighthouse/vendor/laravel/framework/src/Illuminate/Testing/TestResponse.php:761
/workspace/lighthouse/tests/Integration/Schema/Directives/LikeDirectiveTest.php:108