Skip to content

Commit a24a5c7

Browse files
authored
Fix SQLite skipped tests (#90)
1 parent 4c6be03 commit a24a5c7

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

tests/Data/Entries/EntryQueryBuilderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function entries_are_found_using_or_where_not_between()
380380
/** @test **/
381381
public function entries_are_found_using_where_json_contains()
382382
{
383-
if (config('database.default') === 'sqlite') {
383+
if ($this->isUsingSqlite()) {
384384
$this->markTestSkipped('SQLite doesn\'t support JSON contains queries');
385385
}
386386

@@ -404,7 +404,7 @@ public function entries_are_found_using_where_json_contains()
404404
/** @test **/
405405
public function entries_are_found_using_where_json_doesnt_contain()
406406
{
407-
if (config('database.default') === 'sqlite') {
407+
if ($this->isUsingSqlite()) {
408408
$this->markTestSkipped('SQLite doesn\'t support JSON contains queries');
409409
}
410410

@@ -428,7 +428,7 @@ public function entries_are_found_using_where_json_doesnt_contain()
428428
/** @test **/
429429
public function entries_are_found_using_or_where_json_contains()
430430
{
431-
if (config('database.default') === 'sqlite') {
431+
if ($this->isUsingSqlite()) {
432432
$this->markTestSkipped('SQLite doesn\'t support JSON contains queries');
433433
}
434434

@@ -447,7 +447,7 @@ public function entries_are_found_using_or_where_json_contains()
447447
/** @test **/
448448
public function entries_are_found_using_or_where_json_doesnt_contain()
449449
{
450-
if (config('database.default') === 'sqlite') {
450+
if ($this->isUsingSqlite()) {
451451
$this->markTestSkipped('SQLite doesn\'t support JSON contains queries');
452452
}
453453

tests/Data/Taxonomies/TermQueryBuilderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ private function createWhereDateTestTerms()
481481
/** @test **/
482482
public function terms_are_found_using_where_json_contains()
483483
{
484-
if (config('database.default') === 'sqlite') {
484+
if ($this->isUsingSqlite()) {
485485
$this->markTestSkipped('SQLite doesn\'t support JSON contains queries');
486486
}
487487

@@ -506,7 +506,7 @@ public function terms_are_found_using_where_json_contains()
506506
/** @test **/
507507
public function terms_are_found_using_where_json_doesnt_contain()
508508
{
509-
if (config('database.default') === 'sqlite') {
509+
if ($this->isUsingSqlite()) {
510510
$this->markTestSkipped('SQLite doesn\'t support JSON contains queries');
511511
}
512512

@@ -531,7 +531,7 @@ public function terms_are_found_using_where_json_doesnt_contain()
531531
/** @test **/
532532
public function terms_are_found_using_or_where_json_contains()
533533
{
534-
if (config('database.default') === 'sqlite') {
534+
if ($this->isUsingSqlite()) {
535535
$this->markTestSkipped('SQLite doesn\'t support JSON contains queries');
536536
}
537537

@@ -551,7 +551,7 @@ public function terms_are_found_using_or_where_json_contains()
551551
/** @test **/
552552
public function terms_are_found_using_or_where_json_doesnt_contain()
553553
{
554-
if (config('database.default') === 'sqlite') {
554+
if ($this->isUsingSqlite()) {
555555
$this->markTestSkipped('SQLite doesn\'t support JSON contains queries');
556556
}
557557

tests/TestCase.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,11 @@ public function runMigrationsForUUIDEntries()
211211
$migration = require __DIR__.'/../database/migrations/create_entries_table_with_string_ids.php.stub';
212212
$migration->up();
213213
}
214+
215+
protected function isUsingSqlite()
216+
{
217+
$connection = config('database.default');
218+
219+
return config("database.connections.{$connection}.driver") === 'sqlite';
220+
}
214221
}

0 commit comments

Comments
 (0)