generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the TursoConnection inheritance parent class to be Illuminate\…
…Database\Connection
- Loading branch information
1 parent
6b4478e
commit a2da98c
Showing
5 changed files
with
80 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use RichanFongdasen\Turso\Database\TursoPDO; | ||
|
||
beforeEach(function () { | ||
$this->connection = DB::connection('turso'); | ||
}); | ||
|
||
test('it can create a PDO object for read replica database connection', function () { | ||
expect($this->connection->getReadPdo())->toBeInstanceOf(TursoPDO::class); | ||
|
||
$pdo = $this->connection->createReadPdo([ | ||
'db_replica' => '/dev/null', | ||
]); | ||
|
||
expect($pdo)->toBeInstanceOf(\PDO::class) | ||
->and($this->connection->getReadPdo())->toBe($pdo); | ||
})->group('TursoConnectionTest', 'UnitTest'); | ||
|
||
test('it will return null when trying to create read PDO with no replica database path configured', function () { | ||
expect($this->connection->createReadPdo())->toBeNull(); | ||
})->group('TursoConnectionTest', 'UnitTest'); | ||
|
||
test('it can escape binary data and convert it into string type', function () { | ||
$actual = $this->connection->escape('Hello world!', true); | ||
|
||
expect($actual)->toBe("x'48656c6c6f20776f726c6421'"); | ||
})->group('TursoConnectionTest', 'UnitTest'); |