mirror of
https://github.com/dg/dibi.git
synced 2025-07-31 19:30:30 +02:00
tests: remove dependency on dibi_test database name
This commit is contained in:
committed by
David Grudl
parent
8257532630
commit
fe22e230ce
@@ -13,12 +13,13 @@ driver = mysqli
|
||||
host = 127.0.0.1
|
||||
username = root
|
||||
password = "Password12!"
|
||||
database = dibi_test
|
||||
charset = utf8
|
||||
system = mysql
|
||||
|
||||
[mysql pdo]
|
||||
driver = pdo
|
||||
dsn = "mysql:host=127.0.0.1"
|
||||
dsn = "mysql:host=127.0.0.1;dbname=dibi_test"
|
||||
username = root
|
||||
password = "Password12!"
|
||||
system = mysql
|
||||
|
@@ -13,12 +13,13 @@ driver = mysqli
|
||||
host = 127.0.0.1
|
||||
username = root
|
||||
password =
|
||||
database = dibi_test
|
||||
charset = utf8
|
||||
system = mysql
|
||||
|
||||
[mysql pdo]
|
||||
driver = pdo
|
||||
dsn = "mysql:host=127.0.0.1"
|
||||
dsn = "mysql:host=127.0.0.1;dbname=dibi_test"
|
||||
username = root
|
||||
password =
|
||||
system = mysql
|
||||
|
@@ -1,8 +1,7 @@
|
||||
DROP DATABASE IF EXISTS dibi_test;
|
||||
CREATE DATABASE dibi_test;
|
||||
USE dibi_test;
|
||||
|
||||
DROP TABLE IF EXISTS `orders`;
|
||||
DROP TABLE IF EXISTS `products`;
|
||||
DROP TABLE IF EXISTS `customers`;
|
||||
|
||||
CREATE TABLE `products` (
|
||||
`product_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(100) NOT NULL,
|
||||
@@ -15,7 +14,6 @@ INSERT INTO `products` (`product_id`, `title`) VALUES
|
||||
(3, 'Computer'),
|
||||
(2, 'Table');
|
||||
|
||||
DROP TABLE IF EXISTS `customers`;
|
||||
CREATE TABLE `customers` (
|
||||
`customer_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL,
|
||||
@@ -30,7 +28,6 @@ INSERT INTO `customers` (`customer_id`, `name`) VALUES
|
||||
(5, 'Kryten'),
|
||||
(6, 'Kristine Kochanski');
|
||||
|
||||
DROP TABLE IF EXISTS `orders`;
|
||||
CREATE TABLE `orders` (
|
||||
`order_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`customer_id` int(11) NOT NULL,
|
||||
|
@@ -19,12 +19,11 @@ try {
|
||||
Tester\Environment::skip($e->getMessage());
|
||||
}
|
||||
|
||||
if ($config['system'] !== 'sqlsrv') {
|
||||
Assert::same(3, count($meta->getTables()));
|
||||
$names = $meta->getTableNames();
|
||||
sort($names);
|
||||
Assert::equal(['customers', 'orders', 'products'], $names);
|
||||
}
|
||||
$tableNames = $meta->getTableNames();
|
||||
Assert::true(in_array('customers', $tableNames, true));
|
||||
Assert::true(in_array('orders', $tableNames, true));
|
||||
Assert::true(in_array('products', $tableNames, true));
|
||||
|
||||
|
||||
Assert::false($meta->hasTable('xxxx'));
|
||||
|
||||
|
@@ -12,7 +12,6 @@ require __DIR__ . '/bootstrap.php';
|
||||
|
||||
$conn = new Dibi\Connection($config);
|
||||
|
||||
$conn->query('USE dibi_test');
|
||||
$conn->query('DROP TABLE IF EXISTS timetest');
|
||||
$conn->query('CREATE TABLE timetest (col TIME NOT NULL) ENGINE=InnoDB');
|
||||
$conn->query('INSERT INTO timetest VALUES ("12:30:40")');
|
||||
|
Reference in New Issue
Block a user