mirror of
https://github.com/dg/dibi.git
synced 2025-08-13 17:44:11 +02:00
used PHP 7.1 features
- ::class - ... argument unpacking - removed call_user_func - operator ?? - list() - short <?=
This commit is contained in:
@@ -15,21 +15,21 @@ $conn->loadFile(__DIR__ . "/data/$config[system].sql");
|
||||
|
||||
$e = Assert::exception(function () use ($conn) {
|
||||
$conn->query('SELECT');
|
||||
}, 'Dibi\DriverException', '%a% syntax error', 1);
|
||||
}, Dibi\DriverException::class, '%a% syntax error', 1);
|
||||
|
||||
Assert::same('SELECT', $e->getSql());
|
||||
|
||||
|
||||
$e = Assert::exception(function () use ($conn) {
|
||||
$conn->query('INSERT INTO products (product_id, title) VALUES (1, "New")');
|
||||
}, 'Dibi\UniqueConstraintViolationException', NULL, 19);
|
||||
}, Dibi\UniqueConstraintViolationException::class, NULL, 19);
|
||||
|
||||
Assert::same("INSERT INTO products (product_id, title) VALUES (1, 'New')", $e->getSql());
|
||||
|
||||
|
||||
$e = Assert::exception(function () use ($conn) {
|
||||
$conn->query('INSERT INTO products (title) VALUES (NULL)');
|
||||
}, 'Dibi\NotNullConstraintViolationException', NULL, 19);
|
||||
}, Dibi\NotNullConstraintViolationException::class, NULL, 19);
|
||||
|
||||
Assert::same('INSERT INTO products (title) VALUES (NULL)', $e->getSql());
|
||||
|
||||
@@ -37,6 +37,6 @@ Assert::same('INSERT INTO products (title) VALUES (NULL)', $e->getSql());
|
||||
$e = Assert::exception(function () use ($conn) {
|
||||
$conn->query('PRAGMA foreign_keys=true');
|
||||
$conn->query('INSERT INTO orders (customer_id, product_id, amount) VALUES (100, 1, 1)');
|
||||
}, 'Dibi\ForeignKeyConstraintViolationException', NULL, 19);
|
||||
}, Dibi\ForeignKeyConstraintViolationException::class, NULL, 19);
|
||||
|
||||
Assert::same('INSERT INTO orders (customer_id, product_id, amount) VALUES (100, 1, 1)', $e->getSql());
|
||||
|
Reference in New Issue
Block a user