Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
gdebrauwer committed Feb 5, 2024
1 parent eb7b696 commit c9e66a3
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions tests/SushiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function tearDown(): void
}

/** @test */
function basic_usage()
public function basic_usage()
{
$this->assertEquals(3, Foo::count());
$this->assertEquals('bar', Foo::first()->foo);
Expand All @@ -49,7 +49,7 @@ function basic_usage()
}

/** @test */
function columns_with_varying_types()
public function columns_with_varying_types()
{
$row = ModelWithVaryingTypeColumns::first();
$connectionBuilder = ModelWithVaryingTypeColumns::resolveConnection()->getSchemaBuilder();
Expand All @@ -61,7 +61,7 @@ function columns_with_varying_types()
}

/** @test */
function model_with_casts()
public function model_with_casts()
{
$model = ModelWithCasts::first();

Expand All @@ -70,7 +70,7 @@ function model_with_casts()
}

/** @test */
function model_with_custom_schema()
public function model_with_custom_schema()
{
ModelWithCustomSchema::count();
$connectionBuilder = ModelWithCustomSchema::resolveConnection()->getSchemaBuilder();
Expand All @@ -79,7 +79,7 @@ function model_with_custom_schema()
}

/** @test */
function models_using_the_get_rows_property_arent_cached()
public function models_using_the_get_rows_property_arent_cached()
{
Bar::$hasBeenAccessedBefore = false;
$this->assertEquals(2, Bar::count());
Expand All @@ -88,18 +88,18 @@ function models_using_the_get_rows_property_arent_cached()
}

/** @test */
function uses_in_memory_if_the_cache_directory_is_not_writeable_or_not_found()
public function uses_in_memory_if_the_cache_directory_is_not_writeable_or_not_found()
{
config(['sushi.cache-path' => $path = __DIR__ . '/non-existant-path']);

Foo::count();

$this->assertFalse(file_exists($path));
$this->assertEquals(':memory:', (new Foo)->getConnection()->getDatabaseName());
$this->assertEquals(':memory:', (new Foo())->getConnection()->getDatabaseName());
}

/** @test */
function caches_sqlite_file_if_storage_cache_folder_is_available()
public function caches_sqlite_file_if_storage_cache_folder_is_available()
{
Foo::count();

Expand All @@ -111,7 +111,7 @@ function caches_sqlite_file_if_storage_cache_folder_is_available()
}

/** @test */
function avoids_error_when_creating_database_concurrently()
public function avoids_error_when_creating_database_concurrently()
{
$actualFactory = app(ConnectionFactory::class);
$actualConnection = $actualFactory->make([
Expand Down Expand Up @@ -393,7 +393,9 @@ class ModelWithCasts extends Model
'is_boolean' => 'boolean',
];

protected $rows = [
['is_array' => [1, 2, 3], 'is_boolean' => true],
];
protected function getRows() {
return [
['is_array' => json_encode([1, 2, 3]), 'is_boolean' => true],
];
}
}

0 comments on commit c9e66a3

Please sign in to comment.