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

61 lines
1.5 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]
2015-01-12 05:33:41 +01:00
FROM products
INNER JOIN orders USING (product_id)
INNER JOIN customers USING (customer_id)
')->getInfo();
Assert::same(
['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(
['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
Assert::same('xXx', $columns[3]->getName());
2015-10-06 13:14:01 +02:00
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());
Assert::same('xXx', $info->getColumn('xxx')->getName());
Assert::same('xXx', $info->getColumn('xXx')->getName());