Skip to content

Commit

Permalink
tests: test() with description WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Oct 7, 2020
1 parent ff1c9fa commit c07a14b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
12 changes: 6 additions & 6 deletions tests/dibi/Connection.connect.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use Tester\Assert;
require __DIR__ . '/bootstrap.php';


test(function () use ($config) {
test('', function () use ($config) {
$conn = new Connection($config);
Assert::true($conn->isConnected());

Expand All @@ -21,7 +21,7 @@ test(function () use ($config) {
});


test(function () use ($config) { // lazy
test('lazy', function () use ($config) {
$conn = new Connection($config + ['lazy' => true]);
Assert::false($conn->isConnected());

Expand All @@ -30,7 +30,7 @@ test(function () use ($config) { // lazy
});


test(function () use ($config) {
test('', function () use ($config) {
$conn = new Connection($config);
Assert::true($conn->isConnected());

Expand All @@ -40,7 +40,7 @@ test(function () use ($config) {
});


test(function () use ($config) {
test('', function () use ($config) {
$conn = new Connection($config);
Assert::true($conn->isConnected());

Expand All @@ -52,7 +52,7 @@ test(function () use ($config) {
});


test(function () use ($config) {
test('', function () use ($config) {
$conn = new Connection($config);
Assert::equal('hello', $conn->query('SELECT %s', 'hello')->fetchSingle());

Expand All @@ -63,7 +63,7 @@ test(function () use ($config) {
});


test(function () use ($config) {
test('', function () use ($config) {
Assert::exception(function () use ($config) {
new Connection($config + ['onConnect' => '']);
}, InvalidArgumentException::class, "Configuration option 'onConnect' must be array.");
Expand Down
6 changes: 2 additions & 4 deletions tests/dibi/PdoDriver.providedConnection.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ Assert::exception(function () {
}, Dibi\DriverException::class, 'PDO connection in exception or warning error mode is not supported.');


// PDO error mode: explicitly set silent
test(function () {
test('PDO error mode: explicitly set silent', function () {
buildPdoDriver(PDO::ERRMODE_SILENT);
});


// PDO error mode: implicitly set silent
test(function () {
test('PDO error mode: implicitly set silent', function () {
buildPdoDriver(null);
});
16 changes: 8 additions & 8 deletions tests/dibi/Result.normalize.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MockResult extends Dibi\Result
}


test(function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::BOOL);

Expand All @@ -46,7 +46,7 @@ test(function () {
});


test(function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::TEXT);

Expand All @@ -62,7 +62,7 @@ test(function () {
});


test(function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::FLOAT);

Expand Down Expand Up @@ -139,7 +139,7 @@ test(function () {
});


test(function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::INTEGER);

Expand All @@ -165,7 +165,7 @@ test(function () {
});


test(function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::DATETIME);

Expand All @@ -183,7 +183,7 @@ test(function () {
});


test(function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::DATETIME);
$result->setFormat(Type::DATETIME, 'Y-m-d H:i:s');
Expand All @@ -202,7 +202,7 @@ test(function () {
});


test(function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::DATE);

Expand All @@ -218,7 +218,7 @@ test(function () {
});


test(function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::TIME);

Expand Down
2 changes: 1 addition & 1 deletion tests/dibi/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}


function test(Closure $function)
function test(string $title, Closure $function): void
{
$function();
}
Expand Down

0 comments on commit c07a14b

Please sign in to comment.