mirror of
https://github.com/dg/dibi.git
synced 2025-08-30 17:29:53 +02:00
coding style
This commit is contained in:
@@ -73,24 +73,29 @@ test('', function () use ($config) {
|
||||
|
||||
|
||||
test('', function () use ($config) {
|
||||
Assert::exception(function () use ($config) {
|
||||
new Connection($config + ['onConnect' => '']);
|
||||
}, InvalidArgumentException::class, "Configuration option 'onConnect' must be array.");
|
||||
Assert::exception(
|
||||
fn() => new Connection($config + ['onConnect' => '']),
|
||||
InvalidArgumentException::class,
|
||||
"Configuration option 'onConnect' must be array.",
|
||||
);
|
||||
|
||||
$e = Assert::exception(function () use ($config) {
|
||||
new Connection($config + ['onConnect' => ['STOP']]);
|
||||
}, Dibi\DriverException::class);
|
||||
$e = Assert::exception(
|
||||
fn() => new Connection($config + ['onConnect' => ['STOP']]),
|
||||
Dibi\DriverException::class,
|
||||
);
|
||||
Assert::same('STOP', $e->getSql());
|
||||
|
||||
$e = Assert::exception(function () use ($config) {
|
||||
new Connection($config + ['onConnect' => [['STOP %i', 123]]]);
|
||||
}, Dibi\DriverException::class);
|
||||
$e = Assert::exception(
|
||||
fn() => new Connection($config + ['onConnect' => [['STOP %i', 123]]]),
|
||||
Dibi\DriverException::class,
|
||||
);
|
||||
Assert::same('STOP 123', $e->getSql());
|
||||
|
||||
// lazy
|
||||
$conn = new Connection($config + ['lazy' => true, 'onConnect' => ['STOP']]);
|
||||
$e = Assert::exception(function () use ($conn) {
|
||||
$conn->query('SELECT 1');
|
||||
}, Dibi\DriverException::class);
|
||||
$e = Assert::exception(
|
||||
fn() => $conn->query('SELECT 1'),
|
||||
Dibi\DriverException::class,
|
||||
);
|
||||
Assert::same('STOP', $e->getSql());
|
||||
});
|
||||
|
Reference in New Issue
Block a user