Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lapaliv committed Dec 18, 2023
1 parent 71f3329 commit 1defa65
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
16 changes: 4 additions & 12 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Mockery\MockInterface;
use Mockery\VerificationDirector;
use PDO;
use RuntimeException;
use stdClass;

/**
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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 = [];
Expand Down
10 changes: 5 additions & 5 deletions tests/Unit/BulkBuilderTrait/SelectAndUpdateManyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
Expand Down Expand Up @@ -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'],
],
Expand Down Expand Up @@ -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'],
],
Expand All @@ -189,8 +189,8 @@ public function userModelsDataProvider(): array
{
return [
'mysql' => [MySqlUser::class],
'sql' => [PostgreSqlUser::class],
'sql' => [SqLiteUser::class],
'psql' => [PostgreSqlUser::class],
'sqlite' => [SqLiteUser::class],
];
}
}
10 changes: 1 addition & 9 deletions tests/app/Models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Schema\Builder;
use Lapaliv\BulkUpsert\Bulkable;
use Throwable;

/**
* @internal
Expand All @@ -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
Expand Down

0 comments on commit 1defa65

Please sign in to comment.