1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-24 02:43:09 +01:00
php-dibi/tests/dibi/Result.meta.phpt

58 lines
1.4 KiB
Plaintext
Raw Normal View History

2015-01-12 05:33:41 +01:00
<?php
/**
* @dataProvider ../databases.ini
*/
use Tester\Assert;
require __DIR__ . '/bootstrap.php';
if ($config['system'] === 'odbc') {
Tester\Environment::skip('Not supported.');
}
$conn = new Dibi\Connection($config);
2015-01-12 05:33:41 +01:00
$conn->loadFile(__DIR__ . "/data/$config[system].sql");
$info = $conn->query('
SELECT products.product_id, orders.order_id, customers.name, products.product_id + 1 AS xxx
FROM products
INNER JOIN orders USING (product_id)
INNER JOIN customers USING (customer_id)
')->getInfo();
Assert::same(
2015-10-06 01:39:01 +02:00
['product_id', 'order_id', 'name', 'xxx'],
2015-01-12 05:33:41 +01:00
$info->getColumnNames()
);
if ($config['driver'] !== 'sqlite3' && $config['driver'] !== 'pdo') {
Assert::same(
2015-10-06 01:39:01 +02:00
['products.product_id', 'orders.order_id', 'customers.name', 'xxx'],
2015-01-12 05:33:41 +01:00
$info->getColumnNames(TRUE)
);
}
$columns = $info->getColumns();
2015-10-06 13:14:01 +02:00
Assert::same('product_id', $columns[0]->getName());
2015-01-12 05:33:41 +01:00
if ($config['driver'] !== 'sqlite3' && $config['driver'] !== 'pdo') {
2015-10-06 13:14:01 +02:00
Assert::same('products', $columns[0]->getTableName());
2015-01-12 05:33:41 +01:00
}
Assert::null($columns[0]->getVendorInfo('xxx'));
if ($config['system'] !== 'sqlite') {
2015-10-06 13:14:01 +02:00
Assert::same('i', $columns[0]->getType());
2015-01-12 05:33:41 +01:00
}
2015-10-06 13:14:01 +02:00
Assert::null($columns[0]->isNullable());
2015-01-12 05:33:41 +01:00
2015-10-06 13:14:01 +02:00
Assert::same('xxx', $columns[3]->getName());
Assert::null($columns[3]->getTableName());
2015-01-12 05:33:41 +01:00
if ($config['system'] !== 'sqlite') {
2015-10-06 13:14:01 +02:00
Assert::same('i', $columns[0]->getType());
2015-01-12 05:33:41 +01:00
}
2015-10-06 13:14:01 +02:00
Assert::null($columns[3]->isNullable());