1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-22 09:53:11 +01:00

fixed tests

This commit is contained in:
David Grudl 2021-04-23 17:43:30 +02:00
parent 95c3f72a17
commit 3df64fc3b3
5 changed files with 8 additions and 4 deletions

View File

@ -72,7 +72,7 @@ class MySqliDriver implements Dibi\Driver
$host = ini_get('mysqli.default_host');
if ($host) {
$config['host'] = $host;
$config['port'] = ini_get('mysqli.default_port');
$config['port'] = (int) ini_get('mysqli.default_port');
} else {
$config['host'] = null;
$config['port'] = null;

View File

@ -1,7 +1,7 @@
<?php
/**
* @dataProvider ../databases.ini
* @dataProvider ../databases.ini !=sqlsrv
*/
declare(strict_types=1);

View File

@ -23,6 +23,10 @@ try {
$config = reset($config);
}
if (isset($config['port'])) {
$config['port'] = (int) $config['port'];
}
// lock
define('TEMP_DIR', __DIR__ . '/../tmp');

View File

@ -36,7 +36,7 @@ Assert::same('SELECT', $e->getSql());
$e = Assert::exception(function () use ($conn) {
$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());

View File

@ -31,7 +31,7 @@ Assert::same("INSERT INTO products (product_id, title) VALUES (1, 'New')", $e->g
$e = Assert::exception(function () use ($conn) {
$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());