mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 05:07:36 +02:00
tests: remove dependency on dibi_test database name
This commit is contained in:
committed by
David Grudl
parent
8257532630
commit
fe22e230ce
@@ -5,13 +5,16 @@ cache:
|
|||||||
|
|
||||||
clone_folder: c:\projects\dibi
|
clone_folder: c:\projects\dibi
|
||||||
|
|
||||||
|
environment:
|
||||||
|
MYSQL_PWD: Password12!
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- mssql2012sp1
|
- mssql2012sp1
|
||||||
# - mssql2014
|
# - mssql2014
|
||||||
- mysql
|
- mysql
|
||||||
|
|
||||||
init:
|
init:
|
||||||
- SET PATH=c:\php;%PATH%
|
- SET PATH=c:\php;c:\Program Files\MySQL\MySQL Server 5.7\bin;%PATH%
|
||||||
- SET ANSICON=121x90 (121x90)
|
- SET ANSICON=121x90 (121x90)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@@ -40,6 +43,10 @@ install:
|
|||||||
# Create databases.ini
|
# Create databases.ini
|
||||||
- copy tests\databases.appveyor.ini tests\databases.ini
|
- copy tests\databases.appveyor.ini tests\databases.ini
|
||||||
|
|
||||||
|
before_test:
|
||||||
|
# Create MySQL database
|
||||||
|
- mysql --user=root -e "CREATE DATABASE dibi_test"
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- vendor\bin\tester tests -s -p c:\php\php -c tests\php-win.ini
|
- vendor\bin\tester tests -s -p c:\php\php -c tests\php-win.ini
|
||||||
|
|
||||||
|
@@ -13,12 +13,13 @@ driver = mysqli
|
|||||||
host = 127.0.0.1
|
host = 127.0.0.1
|
||||||
username = root
|
username = root
|
||||||
password = "Password12!"
|
password = "Password12!"
|
||||||
|
database = dibi_test
|
||||||
charset = utf8
|
charset = utf8
|
||||||
system = mysql
|
system = mysql
|
||||||
|
|
||||||
[mysql pdo]
|
[mysql pdo]
|
||||||
driver = pdo
|
driver = pdo
|
||||||
dsn = "mysql:host=127.0.0.1"
|
dsn = "mysql:host=127.0.0.1;dbname=dibi_test"
|
||||||
username = root
|
username = root
|
||||||
password = "Password12!"
|
password = "Password12!"
|
||||||
system = mysql
|
system = mysql
|
||||||
|
@@ -13,12 +13,13 @@ driver = mysqli
|
|||||||
host = 127.0.0.1
|
host = 127.0.0.1
|
||||||
username = root
|
username = root
|
||||||
password =
|
password =
|
||||||
|
database = dibi_test
|
||||||
charset = utf8
|
charset = utf8
|
||||||
system = mysql
|
system = mysql
|
||||||
|
|
||||||
[mysql pdo]
|
[mysql pdo]
|
||||||
driver = pdo
|
driver = pdo
|
||||||
dsn = "mysql:host=127.0.0.1"
|
dsn = "mysql:host=127.0.0.1;dbname=dibi_test"
|
||||||
username = root
|
username = root
|
||||||
password =
|
password =
|
||||||
system = mysql
|
system = mysql
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
DROP DATABASE IF EXISTS dibi_test;
|
DROP TABLE IF EXISTS `orders`;
|
||||||
CREATE DATABASE dibi_test;
|
|
||||||
USE dibi_test;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `products`;
|
DROP TABLE IF EXISTS `products`;
|
||||||
|
DROP TABLE IF EXISTS `customers`;
|
||||||
|
|
||||||
CREATE TABLE `products` (
|
CREATE TABLE `products` (
|
||||||
`product_id` int(11) NOT NULL AUTO_INCREMENT,
|
`product_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`title` varchar(100) NOT NULL,
|
`title` varchar(100) NOT NULL,
|
||||||
@@ -15,7 +14,6 @@ INSERT INTO `products` (`product_id`, `title`) VALUES
|
|||||||
(3, 'Computer'),
|
(3, 'Computer'),
|
||||||
(2, 'Table');
|
(2, 'Table');
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `customers`;
|
|
||||||
CREATE TABLE `customers` (
|
CREATE TABLE `customers` (
|
||||||
`customer_id` int(11) NOT NULL AUTO_INCREMENT,
|
`customer_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`name` varchar(100) NOT NULL,
|
`name` varchar(100) NOT NULL,
|
||||||
@@ -30,7 +28,6 @@ INSERT INTO `customers` (`customer_id`, `name`) VALUES
|
|||||||
(5, 'Kryten'),
|
(5, 'Kryten'),
|
||||||
(6, 'Kristine Kochanski');
|
(6, 'Kristine Kochanski');
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `orders`;
|
|
||||||
CREATE TABLE `orders` (
|
CREATE TABLE `orders` (
|
||||||
`order_id` int(11) NOT NULL AUTO_INCREMENT,
|
`order_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`customer_id` int(11) NOT NULL,
|
`customer_id` int(11) NOT NULL,
|
||||||
|
@@ -19,12 +19,11 @@ try {
|
|||||||
Tester\Environment::skip($e->getMessage());
|
Tester\Environment::skip($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config['system'] !== 'sqlsrv') {
|
$tableNames = $meta->getTableNames();
|
||||||
Assert::same(3, count($meta->getTables()));
|
Assert::true(in_array('customers', $tableNames, true));
|
||||||
$names = $meta->getTableNames();
|
Assert::true(in_array('orders', $tableNames, true));
|
||||||
sort($names);
|
Assert::true(in_array('products', $tableNames, true));
|
||||||
Assert::equal(['customers', 'orders', 'products'], $names);
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert::false($meta->hasTable('xxxx'));
|
Assert::false($meta->hasTable('xxxx'));
|
||||||
|
|
||||||
|
@@ -12,7 +12,6 @@ require __DIR__ . '/bootstrap.php';
|
|||||||
|
|
||||||
$conn = new Dibi\Connection($config);
|
$conn = new Dibi\Connection($config);
|
||||||
|
|
||||||
$conn->query('USE dibi_test');
|
|
||||||
$conn->query('DROP TABLE IF EXISTS timetest');
|
$conn->query('DROP TABLE IF EXISTS timetest');
|
||||||
$conn->query('CREATE TABLE timetest (col TIME NOT NULL) ENGINE=InnoDB');
|
$conn->query('CREATE TABLE timetest (col TIME NOT NULL) ENGINE=InnoDB');
|
||||||
$conn->query('INSERT INTO timetest VALUES ("12:30:40")');
|
$conn->query('INSERT INTO timetest VALUES ("12:30:40")');
|
||||||
|
Reference in New Issue
Block a user