1
0
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:
Miloslav Hůla
2022-11-22 09:16:47 +01:00
committed by David Grudl
parent 8257532630
commit fe22e230ce
6 changed files with 20 additions and 16 deletions

View File

@@ -5,13 +5,16 @@ cache:
clone_folder: c:\projects\dibi
environment:
MYSQL_PWD: Password12!
services:
- mssql2012sp1
# - mssql2014
- mysql
init:
- SET PATH=c:\php;%PATH%
- SET PATH=c:\php;c:\Program Files\MySQL\MySQL Server 5.7\bin;%PATH%
- SET ANSICON=121x90 (121x90)
install:
@@ -40,6 +43,10 @@ install:
# Create 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:
- vendor\bin\tester tests -s -p c:\php\php -c tests\php-win.ini

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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'));

View File

@@ -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")');