Skip to content

Commit

Permalink
Add test for empty dbs
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnorthrip committed Mar 14, 2024
1 parent 2e81655 commit 07ae531
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
use Illuminate\Support\Str;
use RonNorthrip\DBPull\Commands\DBPull;

it('can figure out the mysql tables key', function () {
it('can figure out the mysql tables key for empty db', function () {
// $dbname = 'Tables_in_'.Str::snake(config('database.connections.testing.database'));
$dbpull = new DBPull();
$method = new ReflectionMethod(DBPull::class, 'local_tables_key');
$result = $method->invoke($dbpull);
$dbname = 'Tables_in_'.Str::snake(config('database.connections.testing.database'));
expect($result)->toBe($dbname);
expect($result)->toBe(null);
});

it('can figure out the mysql tables list for empty db', function () {
$dbpull = new DBPull();
$method = new ReflectionMethod(DBPull::class, 'local_get_tables');
$result = $method->invoke($dbpull);
expect($result)->toBe([]);
});

0 comments on commit 07ae531

Please sign in to comment.