mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 05:37:39 +02:00
tests: improved descriptions
This commit is contained in:
@@ -12,7 +12,7 @@ use Tester\Assert;
|
|||||||
require __DIR__ . '/bootstrap.php';
|
require __DIR__ . '/bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
test('', function () use ($config) {
|
test('immediate connection and disconnection state', function () use ($config) {
|
||||||
$conn = new Connection($config);
|
$conn = new Connection($config);
|
||||||
Assert::true($conn->isConnected());
|
Assert::true($conn->isConnected());
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ test('', function () use ($config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('lazy', function () use ($config) {
|
test('lazy connection initiated on first query', function () use ($config) {
|
||||||
$conn = new Connection($config + ['lazy' => true]);
|
$conn = new Connection($config + ['lazy' => true]);
|
||||||
Assert::false($conn->isConnected());
|
Assert::false($conn->isConnected());
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ test('lazy', function () use ($config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () use ($config) {
|
test('config retrieval and driver instance access', function () use ($config) {
|
||||||
$conn = new Connection($config);
|
$conn = new Connection($config);
|
||||||
Assert::true($conn->isConnected());
|
Assert::true($conn->isConnected());
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ test('', function () use ($config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () use ($config) {
|
test('idempotent disconnect calls', function () use ($config) {
|
||||||
$conn = new Connection($config);
|
$conn = new Connection($config);
|
||||||
Assert::true($conn->isConnected());
|
Assert::true($conn->isConnected());
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ test('', function () use ($config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () use ($config) {
|
test('reconnect after disconnection', function () use ($config) {
|
||||||
$conn = new Connection($config);
|
$conn = new Connection($config);
|
||||||
Assert::equal('hello', $conn->query('SELECT %s', 'hello')->fetchSingle());
|
Assert::equal('hello', $conn->query('SELECT %s', 'hello')->fetchSingle());
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ test('', function () use ($config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () use ($config) {
|
test('destructor disconnects active connection', function () use ($config) {
|
||||||
$conn = new Connection($config);
|
$conn = new Connection($config);
|
||||||
Assert::true($conn->isConnected());
|
Assert::true($conn->isConnected());
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ test('', function () use ($config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () use ($config) {
|
test('invalid onConnect option triggers exceptions', function () use ($config) {
|
||||||
Assert::exception(
|
Assert::exception(
|
||||||
fn() => new Connection($config + ['onConnect' => '']),
|
fn() => new Connection($config + ['onConnect' => '']),
|
||||||
InvalidArgumentException::class,
|
InvalidArgumentException::class,
|
||||||
|
@@ -25,7 +25,7 @@ class MockResult extends Dibi\Result
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
test('', function () {
|
test('native text conversion preserves boolean values', function () {
|
||||||
$result = new MockResult;
|
$result = new MockResult;
|
||||||
$result->setType('col', Type::Text);
|
$result->setType('col', Type::Text);
|
||||||
$result->setFormat(Type::Text, 'native');
|
$result->setFormat(Type::Text, 'native');
|
||||||
@@ -36,7 +36,7 @@ test('', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () {
|
test('boolean conversion from diverse representations', function () {
|
||||||
$result = new MockResult;
|
$result = new MockResult;
|
||||||
$result->setType('col', Type::Bool);
|
$result->setType('col', Type::Bool);
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ test('', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () {
|
test('text conversion of booleans and numerics', function () {
|
||||||
$result = new MockResult;
|
$result = new MockResult;
|
||||||
$result->setType('col', Type::Text);
|
$result->setType('col', Type::Text);
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ test('', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () {
|
test('float conversion with various numeric formats', function () {
|
||||||
$result = new MockResult;
|
$result = new MockResult;
|
||||||
$result->setType('col', Type::Float);
|
$result->setType('col', Type::Float);
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ test('', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () {
|
test('strict integer conversion with error on empty string', function () {
|
||||||
$result = new MockResult;
|
$result = new MockResult;
|
||||||
$result->setType('col', Type::Integer);
|
$result->setType('col', Type::Integer);
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ test('', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () {
|
test('dateTime conversion with object instantiation', function () {
|
||||||
$result = new MockResult;
|
$result = new MockResult;
|
||||||
$result->setType('col', Type::DateTime);
|
$result->setType('col', Type::DateTime);
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ test('', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () {
|
test('dateTime conversion using custom format', function () {
|
||||||
$result = new MockResult;
|
$result = new MockResult;
|
||||||
$result->setType('col', Type::DateTime);
|
$result->setType('col', Type::DateTime);
|
||||||
$result->setFormat(Type::DateTime, 'Y-m-d H:i:s');
|
$result->setFormat(Type::DateTime, 'Y-m-d H:i:s');
|
||||||
@@ -283,7 +283,7 @@ test('', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () {
|
test('date conversion to DateTime instance', function () {
|
||||||
$result = new MockResult;
|
$result = new MockResult;
|
||||||
$result->setType('col', Type::Date);
|
$result->setType('col', Type::Date);
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ test('', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('', function () {
|
test('time conversion to DateTime instance', function () {
|
||||||
$result = new MockResult;
|
$result = new MockResult;
|
||||||
$result->setType('col', Type::Time);
|
$result->setType('col', Type::Time);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user