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

38 lines
801 B
Plaintext
Raw Normal View History

2015-01-12 05:33:41 +01:00
<?php
/**
* @dataProvider ../databases.ini
*/
use Tester\Assert;
require __DIR__ . '/bootstrap.php';
2015-06-19 03:11:36 +02:00
test(function () use ($config) {
2015-01-12 05:33:41 +01:00
$conn = new DibiConnection($config);
Assert::true($conn->isConnected());
$conn->disconnect();
Assert::false($conn->isConnected());
});
2015-06-19 03:11:36 +02:00
test(function () use ($config) { // lazy
2015-10-06 01:39:01 +02:00
$conn = new DibiConnection($config + ['lazy' => TRUE]);
2015-01-12 05:33:41 +01:00
Assert::false($conn->isConnected());
$conn->query('SELECT 1');
Assert::true($conn->isConnected());
});
2015-06-19 03:11:36 +02:00
test(function () use ($config) { // query string
2015-01-12 05:33:41 +01:00
$conn = new DibiConnection(http_build_query($config, NULL, '&'));
Assert::true($conn->isConnected());
Assert::null($conn->getConfig('lazy'));
Assert::same($config['driver'], $conn->getConfig('driver'));
Assert::type('IDibiDriver', $conn->getDriver());
});