diff --git a/tests/TestCase.php b/tests/TestCase.php index 37ec896..e5dc0c8 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -10,6 +10,7 @@ use Mockery\MockInterface; use Mockery\VerificationDirector; use PDO; +use RuntimeException; use stdClass; /** @@ -41,7 +42,7 @@ public static function setUpBeforeClass(): void } if (!touch($sqlitePath)) { - dd('touch fail'); + throw new RuntimeException('SQLite database was not created'); } self::configureManager(); @@ -76,16 +77,7 @@ protected function setUp(): void $this->app->register(BulkUpsertServiceProvider::class); } -// protected function tearDown(): void -// { -// if (file_exists(self::getSqLitePath())) { -// unlink(self::getSqLitePath()); -// } -// -// parent::tearDown(); -// } - - public function assertDatabaseMissing($table, array $data, $connection = null) + public function assertDatabaseMissing($table, array $data, $connection = null): void { $filters = []; $jsons = []; @@ -143,7 +135,7 @@ protected function spyShouldNotHaveReceived(LegacyMockInterface|MockInterface $s $spy->shouldNotHaveReceived('__invoke'); } - protected function assertDatabaseHas($table, array $data, $connection = null) + protected function assertDatabaseHas($table, array $data, $connection = null): void { $filters = []; $jsons = []; diff --git a/tests/Unit/BulkBuilderTrait/SelectAndUpdateManyTest.php b/tests/Unit/BulkBuilderTrait/SelectAndUpdateManyTest.php index 7c99231..1dbc6dd 100644 --- a/tests/Unit/BulkBuilderTrait/SelectAndUpdateManyTest.php +++ b/tests/Unit/BulkBuilderTrait/SelectAndUpdateManyTest.php @@ -63,7 +63,7 @@ function (User $user) use ($values) { 'posts_count' => $values['posts_count'], 'is_admin' => $values['is_admin'], 'balance' => $values['balance'], - 'birthday' => $values['birthday'], + 'birthday' => $values['birthday']?->toDateString(), 'phones' => $values['phones'], 'last_visited_at' => $values['last_visited_at'], ], @@ -119,7 +119,7 @@ function (User $user) use ($values) { 'posts_count' => $values['posts_count'], 'is_admin' => $values['is_admin'], 'balance' => $values['balance'], - 'birthday' => $values['birthday'], + 'birthday' => $values['birthday']?->toDateString(), 'phones' => $values['phones'], 'last_visited_at' => $values['last_visited_at'], ], @@ -175,7 +175,7 @@ function (User $user) use ($values) { 'posts_count' => $values['posts_count'], 'is_admin' => $values['is_admin'], 'balance' => $values['balance'], - 'birthday' => $values['birthday'], + 'birthday' => $values['birthday']?->toDateString(), 'phones' => $values['phones'], 'last_visited_at' => $values['last_visited_at'], ], @@ -189,8 +189,8 @@ public function userModelsDataProvider(): array { return [ 'mysql' => [MySqlUser::class], - 'sql' => [PostgreSqlUser::class], - 'sql' => [SqLiteUser::class], + 'psql' => [PostgreSqlUser::class], + 'sqlite' => [SqLiteUser::class], ]; } } diff --git a/tests/app/Models/Model.php b/tests/app/Models/Model.php index 8c899f2..7eef027 100644 --- a/tests/app/Models/Model.php +++ b/tests/app/Models/Model.php @@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Database\Schema\Builder; use Lapaliv\BulkUpsert\Bulkable; -use Throwable; /** * @internal @@ -28,14 +27,7 @@ public static function registerModelEvent($event, $callback): void public static function dropTable(): void { - try { - self::getSchema()->dropIfExists(self::table()); - } catch (Throwable $throwable) { - dump(static::class); - - throw $throwable; - // - } + self::getSchema()->dropIfExists(self::table()); } protected static function getSchema(): Builder