mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 06:07:39 +02:00
fixed tests
This commit is contained in:
@@ -72,7 +72,7 @@ class MySqliDriver implements Dibi\Driver
|
|||||||
$host = ini_get('mysqli.default_host');
|
$host = ini_get('mysqli.default_host');
|
||||||
if ($host) {
|
if ($host) {
|
||||||
$config['host'] = $host;
|
$config['host'] = $host;
|
||||||
$config['port'] = ini_get('mysqli.default_port');
|
$config['port'] = (int) ini_get('mysqli.default_port');
|
||||||
} else {
|
} else {
|
||||||
$config['host'] = null;
|
$config['host'] = null;
|
||||||
$config['port'] = null;
|
$config['port'] = null;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider ../databases.ini
|
* @dataProvider ../databases.ini !=sqlsrv
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
@@ -23,6 +23,10 @@ try {
|
|||||||
$config = reset($config);
|
$config = reset($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($config['port'])) {
|
||||||
|
$config['port'] = (int) $config['port'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// lock
|
// lock
|
||||||
define('TEMP_DIR', __DIR__ . '/../tmp');
|
define('TEMP_DIR', __DIR__ . '/../tmp');
|
||||||
|
@@ -36,7 +36,7 @@ Assert::same('SELECT', $e->getSql());
|
|||||||
|
|
||||||
$e = Assert::exception(function () use ($conn) {
|
$e = Assert::exception(function () use ($conn) {
|
||||||
$conn->query('INSERT INTO products (product_id, title) VALUES (1, "New")');
|
$conn->query('INSERT INTO products (product_id, title) VALUES (1, "New")');
|
||||||
}, Dibi\UniqueConstraintViolationException::class, "%a?%Duplicate entry '1' for key 'PRIMARY'", 1062);
|
}, Dibi\UniqueConstraintViolationException::class, "%a?%Duplicate entry '1' for key '%a?%PRIMARY'", 1062);
|
||||||
|
|
||||||
Assert::same("INSERT INTO products (product_id, title) VALUES (1, 'New')", $e->getSql());
|
Assert::same("INSERT INTO products (product_id, title) VALUES (1, 'New')", $e->getSql());
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ Assert::same("INSERT INTO products (product_id, title) VALUES (1, 'New')", $e->g
|
|||||||
|
|
||||||
$e = Assert::exception(function () use ($conn) {
|
$e = Assert::exception(function () use ($conn) {
|
||||||
$conn->query('INSERT INTO products (title) VALUES (NULL)');
|
$conn->query('INSERT INTO products (title) VALUES (NULL)');
|
||||||
}, Dibi\NotNullConstraintViolationException::class, '%a?%null value in column "title" violates not-null constraint%A?%', '23502');
|
}, Dibi\NotNullConstraintViolationException::class, '%a?%null value in column "title"%a%violates not-null constraint%A?%', '23502');
|
||||||
|
|
||||||
Assert::same('INSERT INTO products (title) VALUES (NULL)', $e->getSql());
|
Assert::same('INSERT INTO products (title) VALUES (NULL)', $e->getSql());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user