diff --git a/tests/databases.sample.ini b/tests/databases.sample.ini index fd155ee2..1915dfa3 100644 --- a/tests/databases.sample.ini +++ b/tests/databases.sample.ini @@ -19,12 +19,12 @@ driver = sqlite3 database = :memory: system = sqlite -[pgsql] +[postgre] driver = postgre host = 127.0.0.1 username = postgres password = -system = pgsql +system = postgre [odbc] driver = odbc @@ -63,9 +63,9 @@ username = root password = system = mysql -[pgsql-pdo] +[postgre-pdo] driver = pdo dsn = "pgsql:host=127.0.0.1;dbname=dibi_test" username = postgres password = -system = pgsql +system = postgre diff --git a/tests/dibi/Postgre.like.phpt b/tests/dibi/Postgre.like.phpt index 0b01cc12..3e4febd4 100644 --- a/tests/dibi/Postgre.like.phpt +++ b/tests/dibi/Postgre.like.phpt @@ -8,7 +8,7 @@ use Tester\Assert; require __DIR__ . '/bootstrap.php'; -if ($config['system'] !== 'pgsql') { +if ($config['system'] !== 'postgre') { Tester\Environment::skip("Not supported system '$config[system]'."); } diff --git a/tests/dibi/Translator.phpt b/tests/dibi/Translator.phpt index c0d585dc..e6939da2 100644 --- a/tests/dibi/Translator.phpt +++ b/tests/dibi/Translator.phpt @@ -161,7 +161,7 @@ if ($config['system'] === 'odbc') { Assert::same( reformat([ 'mysql' => 'SELECT * FROM `products` LIMIT 18446744073709551615 OFFSET 50', - 'pgsql' => 'SELECT * FROM "products" OFFSET 50', + 'postgre' => 'SELECT * FROM "products" OFFSET 50', 'SELECT * FROM [products] LIMIT -1 OFFSET 50', ]), $conn->translate('SELECT * FROM [products] %ofs', 50) @@ -200,7 +200,7 @@ $args = [ "a\n%_\\'\"", ]; -if ($config['system'] === 'pgsql') { +if ($config['system'] === 'postgre') { $conn->query('SET escape_string_warning = off'); // do not log warnings $conn->query('SET standard_conforming_strings = off'); @@ -303,7 +303,7 @@ WHERE (`test`.`a` LIKE '1995-03-01' OR `str_null`=NULL OR `str_not_null`='hello' LIMIT 10", - 'pgsql' => 'SELECT * + 'postgre' => 'SELECT * FROM "db"."table" WHERE ("test"."a" LIKE \'1995-03-01\' OR "b1" IN ( 1, 2, 3 ) diff --git a/tests/dibi/bootstrap.php b/tests/dibi/bootstrap.php index 3586f970..a040e613 100644 --- a/tests/dibi/bootstrap.php +++ b/tests/dibi/bootstrap.php @@ -61,7 +61,7 @@ function reformat($s) } if ($config['system'] === 'mysql') { return strtr($s, '[]', '``'); - } elseif ($config['system'] === 'pgsql') { + } elseif ($config['system'] === 'postgre') { return strtr($s, '[]', '""'); } elseif ($config['system'] === 'odbc' || $config['system'] === 'sqlite') { return $s; diff --git a/tests/dibi/data/mysql.sql b/tests/dibi/data/mysql.sql index c91ca37f..ecfb1560 100644 --- a/tests/dibi/data/mysql.sql +++ b/tests/dibi/data/mysql.sql @@ -7,7 +7,7 @@ USE dibi_test; DROP TABLE IF EXISTS `products`; CREATE TABLE `products` ( `product_id` int(11) NOT NULL AUTO_INCREMENT, - `title` varchar(100) DEFAULT NULL, + `title` varchar(100) NOT NULL, PRIMARY KEY (`product_id`), KEY `title` (`title`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -20,7 +20,7 @@ INSERT INTO `products` (`product_id`, `title`) VALUES DROP TABLE IF EXISTS `customers`; CREATE TABLE `customers` ( `customer_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(100) DEFAULT NULL, + `name` varchar(100) NOT NULL, PRIMARY KEY (`customer_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/tests/dibi/data/pgsql.sql b/tests/dibi/data/postgre.sql similarity index 95% rename from tests/dibi/data/pgsql.sql rename to tests/dibi/data/postgre.sql index 9ca52a79..aba69d82 100644 --- a/tests/dibi/data/pgsql.sql +++ b/tests/dibi/data/postgre.sql @@ -4,7 +4,7 @@ CREATE SCHEMA public; CREATE TABLE products ( product_id serial NOT NULL, - title varchar(100) DEFAULT NULL, + title varchar(100) NOT NULL, PRIMARY KEY (product_id) ); @@ -18,7 +18,7 @@ CREATE INDEX title ON products USING btree (title); CREATE TABLE customers ( customer_id serial NOT NULL, - name varchar(100) DEFAULT NULL, + name varchar(100) NOT NULL, PRIMARY KEY (customer_id) ); diff --git a/tests/dibi/data/sqlite.sql b/tests/dibi/data/sqlite.sql index b736ed29..e73902f5 100644 --- a/tests/dibi/data/sqlite.sql +++ b/tests/dibi/data/sqlite.sql @@ -1,6 +1,6 @@ CREATE TABLE [products] ( [product_id] INTEGER NOT NULL PRIMARY KEY, - [title] VARCHAR(100) NULL + [title] VARCHAR(100) NOT NULL ); CREATE INDEX "title" ON "products" ("title"); @@ -11,7 +11,7 @@ INSERT INTO "products" ("product_id", "title") VALUES (3, 'Computer'); CREATE TABLE [customers] ( [customer_id] INTEGER PRIMARY KEY NOT NULL, - [name] VARCHAR(100) NULL + [name] VARCHAR(100) NOT NULL ); INSERT INTO "customers" ("customer_id", "name") VALUES (1, 'Dave Lister'); @@ -25,7 +25,9 @@ CREATE TABLE [orders] ( [order_id] INTEGER NOT NULL PRIMARY KEY, [customer_id] INTEGER NOT NULL, [product_id] INTEGER NOT NULL, - [amount] FLOAT NOT NULL + [amount] FLOAT NOT NULL, + CONSTRAINT orders_product FOREIGN KEY (product_id) REFERENCES products (product_id), + CONSTRAINT orders_customer FOREIGN KEY (customer_id) REFERENCES customers (customer_id) ); INSERT INTO "orders" ("order_id", "customer_id", "product_id", "amount") VALUES (1, 2, 1, '7.0'); diff --git a/tests/dibi/meta.phpt b/tests/dibi/meta.phpt index 402bbb60..4b62581a 100644 --- a/tests/dibi/meta.phpt +++ b/tests/dibi/meta.phpt @@ -50,7 +50,7 @@ Assert::same('products', $column->getTable()->getName()); Assert::same('s', $column->getType()); Assert::type('string', $column->getNativeType()); Assert::same(100, $column->getSize()); -Assert::true($column->isNullable()); +Assert::false($column->isNullable()); Assert::false($column->isAutoIncrement()); //Assert::null($column->getDefault());