mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 14:16:39 +02:00
tests: test() with description
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -40,7 +40,7 @@ test(function () use ($config) {
|
||||
});
|
||||
|
||||
|
||||
test(function () use ($config) {
|
||||
test('', function () use ($config) {
|
||||
$conn = new Connection($config);
|
||||
Assert::true($conn->isConnected());
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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.");
|
||||
|
@@ -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);
|
||||
});
|
||||
|
@@ -24,7 +24,7 @@ class MockResult extends Dibi\Result
|
||||
}
|
||||
|
||||
|
||||
test(function () {
|
||||
test('', function () {
|
||||
$result = new MockResult;
|
||||
$result->setType('col', Type::BOOL);
|
||||
|
||||
@@ -46,7 +46,7 @@ test(function () {
|
||||
});
|
||||
|
||||
|
||||
test(function () {
|
||||
test('', function () {
|
||||
$result = new MockResult;
|
||||
$result->setType('col', Type::TEXT);
|
||||
|
||||
@@ -62,7 +62,7 @@ test(function () {
|
||||
});
|
||||
|
||||
|
||||
test(function () {
|
||||
test('', function () {
|
||||
$result = new MockResult;
|
||||
$result->setType('col', Type::FLOAT);
|
||||
|
||||
@@ -139,7 +139,7 @@ test(function () {
|
||||
});
|
||||
|
||||
|
||||
test(function () {
|
||||
test('', function () {
|
||||
$result = new MockResult;
|
||||
$result->setType('col', Type::INTEGER);
|
||||
|
||||
@@ -165,7 +165,7 @@ test(function () {
|
||||
});
|
||||
|
||||
|
||||
test(function () {
|
||||
test('', function () {
|
||||
$result = new MockResult;
|
||||
$result->setType('col', Type::DATETIME);
|
||||
|
||||
@@ -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');
|
||||
@@ -202,7 +202,7 @@ test(function () {
|
||||
});
|
||||
|
||||
|
||||
test(function () {
|
||||
test('', function () {
|
||||
$result = new MockResult;
|
||||
$result->setType('col', Type::DATE);
|
||||
|
||||
@@ -218,7 +218,7 @@ test(function () {
|
||||
});
|
||||
|
||||
|
||||
test(function () {
|
||||
test('', function () {
|
||||
$result = new MockResult;
|
||||
$result->setType('col', Type::TIME);
|
||||
|
||||
|
@@ -37,7 +37,7 @@ if ($config['system'] === 'odbc') {
|
||||
}
|
||||
|
||||
|
||||
function test(Closure $function)
|
||||
function test(string $title, Closure $function): void
|
||||
{
|
||||
$function();
|
||||
}
|
||||
|
Reference in New Issue
Block a user