Skip to content

Commit b09b5ba

Browse files
committed
tests: test() with description
1 parent 1f457f6 commit b09b5ba

File tree

61 files changed

+246
-275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+246
-275
lines changed

tests/Database.DI/DatabaseExtension.basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use Tester\Assert;
1414
require __DIR__ . '/../bootstrap.php';
1515

1616

17-
test(function () {
17+
test('', function () {
1818
$loader = new DI\Config\Loader;
1919
$config = $loader->load(Tester\FileMock::create('
2020
database:

tests/Database.DI/DatabaseExtension.multiple.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use Tester\Assert;
1414
require __DIR__ . '/../bootstrap.php';
1515

1616

17-
test(function () {
17+
test('', function () {
1818
$loader = new DI\Config\Loader;
1919
$config = $loader->load(Tester\FileMock::create('
2020
database:

tests/Database/Connection.fetch.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require __DIR__ . '/connect.inc.php'; // create $connection
1414
Nette\Database\Helpers::loadFromFile($connection, __DIR__ . "/files/{$driverName}-nette_test1.sql");
1515

1616

17-
test(function () use ($connection) { // fetch
17+
test('fetch', function () use ($connection) {
1818
$row = $connection->fetch('SELECT name, id FROM author WHERE id = ?', 11);
1919
Assert::type(Nette\Database\Row::class, $row);
2020
Assert::equal(Nette\Database\Row::from([
@@ -24,17 +24,17 @@ test(function () use ($connection) { // fetch
2424
});
2525

2626

27-
test(function () use ($connection) { // fetchField
27+
test('fetchField', function () use ($connection) {
2828
Assert::same('Jakub Vrana', $connection->fetchField('SELECT name FROM author ORDER BY id'));
2929
});
3030

3131

32-
test(function () use ($connection) { // fetchFields
32+
test('fetchFields', function () use ($connection) {
3333
Assert::same([11, 'Jakub Vrana'], $connection->fetchFields('SELECT id, name FROM author ORDER BY id'));
3434
});
3535

3636

37-
test(function () use ($connection) { // fetchPairs
37+
test('fetchPairs', function () use ($connection) {
3838
$pairs = $connection->fetchPairs('SELECT name, id FROM author WHERE id > ? ORDER BY id', 11);
3939
Assert::same([
4040
'David Grudl' => 12,
@@ -43,7 +43,7 @@ test(function () use ($connection) { // fetchPairs
4343
});
4444

4545

46-
test(function () use ($connection) { // fetchAll
46+
test('fetchAll', function () use ($connection) {
4747
$arr = $connection->fetchAll('SELECT name, id FROM author WHERE id < ? ORDER BY id', 13);
4848
Assert::equal([
4949
Nette\Database\Row::from(['name' => 'Jakub Vrana', 'id' => 11]),

tests/Database/Connection.lazy.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ use Tester\Assert;
1414
require __DIR__ . '/../bootstrap.php';
1515

1616

17-
test(function () { // non lazy
17+
test('non lazy', function () {
1818
Assert::exception(function () {
1919
$connection = new Nette\Database\Connection('dsn', 'user', 'password');
2020
}, Nette\Database\DriverException::class, 'invalid data source name');
2121
});
2222

2323

24-
test(function () { // lazy
24+
test('lazy', function () {
2525
$connection = new Nette\Database\Connection('dsn', 'user', 'password', ['lazy' => true]);
2626
$context = new Nette\Database\Context($connection, new Structure($connection, new DevNullStorage));
2727
Assert::exception(function () use ($context) {
@@ -30,15 +30,15 @@ test(function () { // lazy
3030
});
3131

3232

33-
test(function () {
33+
test('', function () {
3434
$connection = new Nette\Database\Connection('dsn', 'user', 'password', ['lazy' => true]);
3535
Assert::exception(function () use ($connection) {
3636
$connection->quote('x');
3737
}, Nette\Database\DriverException::class, 'invalid data source name');
3838
});
3939

4040

41-
test(function () { // connect & disconnect
41+
test('connect & disconnect', function () {
4242
$options = Tester\Environment::loadData() + ['user' => null, 'password' => null];
4343
$connections = 1;
4444

tests/Database/Connection.query.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require __DIR__ . '/connect.inc.php'; // create $connection
1414
Nette\Database\Helpers::loadFromFile($connection, __DIR__ . "/files/{$driverName}-nette_test1.sql");
1515

1616

17-
test(function () use ($connection) {
17+
test('', function () use ($connection) {
1818
$res = $connection->query('SELECT id FROM author WHERE id = ?', 11);
1919
Assert::type(Nette\Database\ResultSet::class, $res);
2020
Assert::same('SELECT id FROM author WHERE id = ?', $res->getQueryString());
@@ -23,14 +23,14 @@ test(function () use ($connection) {
2323
});
2424

2525

26-
test(function () use ($connection) {
26+
test('', function () use ($connection) {
2727
$res = $connection->query('SELECT id FROM author WHERE id = ? OR id = ?', 11, 12);
2828
Assert::same('SELECT id FROM author WHERE id = ? OR id = ?', $res->getQueryString());
2929
Assert::same([11, 12], $res->getParameters());
3030
});
3131

3232

33-
test(function () use ($connection) {
33+
test('', function () use ($connection) {
3434
$res = $connection->queryArgs('SELECT id FROM author WHERE id = ? OR id = ?', [11, 12]);
3535
Assert::same('SELECT id FROM author WHERE id = ? OR id = ?', $res->getQueryString());
3636
Assert::same([11, 12], $res->getParameters());

tests/Database/Context.fetch.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require __DIR__ . '/connect.inc.php'; // create $connection
1414
Nette\Database\Helpers::loadFromFile($connection, __DIR__ . "/files/{$driverName}-nette_test1.sql");
1515

1616

17-
test(function () use ($context) { // fetch
17+
test('fetch', function () use ($context) {
1818
$row = $context->fetch('SELECT name, id FROM author WHERE id = ?', 11);
1919
Assert::type(Nette\Database\Row::class, $row);
2020
Assert::equal(Nette\Database\Row::from([
@@ -24,17 +24,17 @@ test(function () use ($context) { // fetch
2424
});
2525

2626

27-
test(function () use ($context) { // fetchField
27+
test('fetchField', function () use ($context) {
2828
Assert::same('Jakub Vrana', $context->fetchField('SELECT name FROM author ORDER BY id'));
2929
});
3030

3131

32-
test(function () use ($context) { // fetchFields
32+
test('fetchFields', function () use ($context) {
3333
Assert::same([11, 'Jakub Vrana'], $context->fetchFields('SELECT id, name FROM author ORDER BY id'));
3434
});
3535

3636

37-
test(function () use ($context) { // fetchPairs
37+
test('fetchPairs', function () use ($context) {
3838
$pairs = $context->fetchPairs('SELECT name, id FROM author WHERE id > ? ORDER BY id', 11);
3939
Assert::same([
4040
'David Grudl' => 12,
@@ -43,7 +43,7 @@ test(function () use ($context) { // fetchPairs
4343
});
4444

4545

46-
test(function () use ($context) { // fetchAll
46+
test('fetchAll', function () use ($context) {
4747
$arr = $context->fetchAll('SELECT name, id FROM author WHERE id < ? ORDER BY id', 13);
4848
Assert::equal([
4949
Nette\Database\Row::from(['name' => 'Jakub Vrana', 'id' => 11]),

tests/Database/Context.query.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ require __DIR__ . '/connect.inc.php'; // create $connection
1414
Nette\Database\Helpers::loadFromFile($connection, __DIR__ . "/files/{$driverName}-nette_test1.sql");
1515

1616

17-
test(function () use ($context) {
17+
test('', function () use ($context) {
1818
$res = $context->query('SELECT id FROM author WHERE id = ?', 11);
1919
Assert::type(Nette\Database\ResultSet::class, $res);
2020
Assert::same('SELECT id FROM author WHERE id = ?', $res->getQueryString());
2121
Assert::same([11], $res->getParameters());
2222
});
2323

2424

25-
test(function () use ($context) {
25+
test('', function () use ($context) {
2626
$res = $context->query('SELECT id FROM author WHERE id = ? OR id = ?', 11, 12);
2727
Assert::same('SELECT id FROM author WHERE id = ? OR id = ?', $res->getQueryString());
2828
Assert::same([11, 12], $res->getParameters());
2929
});
3030

3131

32-
test(function () use ($context) {
32+
test('', function () use ($context) {
3333
$res = $context->queryArgs('SELECT id FROM author WHERE id = ? OR id = ?', [11, 12]);
3434
Assert::same('SELECT id FROM author WHERE id = ? OR id = ?', $res->getQueryString());
3535
Assert::same([11, 12], $res->getParameters());

tests/Database/Context.transaction.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require __DIR__ . '/connect.inc.php'; // create $connection
1414
Nette\Database\Helpers::loadFromFile($connection, __DIR__ . "/files/{$driverName}-nette_test1.sql");
1515

1616

17-
test(function () use ($context) {
17+
test('', function () use ($context) {
1818
$context->beginTransaction();
1919
$context->query('DELETE FROM book');
2020
$context->rollBack();
@@ -23,7 +23,7 @@ test(function () use ($context) {
2323
});
2424

2525

26-
test(function () use ($context) {
26+
test('', function () use ($context) {
2727
$context->beginTransaction();
2828
$context->query('DELETE FROM book');
2929
$context->commit();

tests/Database/Conventions/DiscoveredConventions.getBelongsToReference().phpt

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ use Tester\Assert;
1212
require __DIR__ . '/../../bootstrap.php';
1313

1414

15-
// basic test
16-
test(function () {
15+
test('basic test', function () {
1716
$structure = Mockery::mock(Nette\Database\IStructure::class);
1817
$structure->shouldReceive('getBelongsToReference')->with('books')->andReturn([
1918
'author_id' => 'authors',
@@ -26,8 +25,7 @@ test(function () {
2625
Assert::same(['authors', 'translator_id'], $conventions->getBelongsToReference('books', 'translator'));
2726
});
2827

29-
// basic test
30-
test(function () {
28+
test('basic test', function () {
3129
$structure = Mockery::mock(Nette\Database\IStructure::class);
3230
$structure->shouldReceive('getBelongsToReference')->with('public.books')->andReturn([
3331
'author_id' => 'public.authors',
@@ -40,8 +38,7 @@ test(function () {
4038
Assert::same(['public.authors', 'translator_id'], $conventions->getBelongsToReference('public.books', 'translator'));
4139
});
4240

43-
// tests order of table columns with foreign keys
44-
test(function () {
41+
test('tests order of table columns with foreign keys', function () {
4542
$structure = Mockery::mock(Nette\Database\IStructure::class);
4643
$structure->shouldReceive('getBelongsToReference')->with('books')->andReturn([
4744
'translator_id' => 'authors',
@@ -54,8 +51,7 @@ test(function () {
5451
});
5552

5653

57-
// tests case insensivity
58-
test(function () {
54+
test('tests case insensivity', function () {
5955
$structure = Mockery::mock(Nette\Database\IStructure::class);
6056
$structure->shouldReceive('getBelongsToReference')->with('books')->andReturn([
6157
'author_id' => 'authors',
@@ -68,8 +64,7 @@ test(function () {
6864
});
6965

7066

71-
// tests case insensivity and prefixes
72-
test(function () {
67+
test('tests case insensivity and prefixes', function () {
7368
$structure = Mockery::mock(Nette\Database\IStructure::class);
7469
$structure->shouldReceive('getBelongsToReference')->with('nBooks')->andReturn([
7570
'authorId' => 'nAuthors',
@@ -83,8 +78,7 @@ test(function () {
8378
});
8479

8580

86-
// tests rebuilt
87-
test(function () {
81+
test('tests rebuilt', function () {
8882
$structure = Mockery::mock(Nette\Database\IStructure::class);
8983
$structure->shouldReceive('isRebuilt')->andReturn(false);
9084
$structure->shouldReceive('rebuild');
@@ -101,8 +95,7 @@ test(function () {
10195
});
10296

10397

104-
// tests already rebuilt structure
105-
test(function () {
98+
test('tests already rebuilt structure', function () {
10699
$structure = Mockery::mock(Nette\Database\IStructure::class);
107100
$structure->shouldReceive('isRebuilt')->andReturn(true);
108101
$structure->shouldReceive('getBelongsToReference')->with('books')->andReturn([])->once();

tests/Database/Conventions/DiscoveredConventions.getHasManyReference().phpt

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ use Tester\Assert;
1212
require __DIR__ . '/../../bootstrap.php';
1313

1414

15-
// basic test singular
16-
test(function () {
15+
test('basic test singular', function () {
1716
$structure = Mockery::mock(Nette\Database\IStructure::class);
1817
$structure->shouldReceive('getHasManyReference')->with('author')->andReturn([
1918
'book' => ['author_id', 'translator_id'],
@@ -42,8 +41,7 @@ test(function () {
4241
});
4342

4443

45-
// basic test singular with schema
46-
test(function () {
44+
test('basic test singular with schema', function () {
4745
$structure = Mockery::mock(Nette\Database\IStructure::class);
4846
$structure->shouldReceive('getHasManyReference')->with('public.author')->andReturn([
4947
'public.book' => ['author_id', 'translator_id'],
@@ -86,8 +84,7 @@ test(function () {
8684
});
8785

8886

89-
// basic test plural
90-
test(function () {
87+
test('basic test plural', function () {
9188
$structure = Mockery::mock(Nette\Database\IStructure::class);
9289
$structure->shouldReceive('getHasManyReference')->with('authors')->andReturn([
9390
'books' => ['author_id', 'translator_id'],
@@ -110,8 +107,7 @@ test(function () {
110107
});
111108

112109

113-
// tests column match with source table
114-
test(function () {
110+
test('tests column match with source table', function () {
115111
$structure = Mockery::mock(Nette\Database\IStructure::class);
116112
$structure->shouldReceive('getHasManyReference')->with('author')->andReturn([
117113
'book' => ['author_id', 'tran_id'],
@@ -137,8 +133,7 @@ test(function () {
137133
});
138134

139135

140-
// tests case insensivity and prefixes
141-
test(function () {
136+
test('tests case insensivity and prefixes', function () {
142137
$structure = Mockery::mock(Nette\Database\IStructure::class);
143138
$structure->shouldReceive('getHasManyReference')->with('nAuthors')->andReturn([
144139
'nBooks' => ['authorId', 'translatorId'],
@@ -150,8 +145,7 @@ test(function () {
150145
});
151146

152147

153-
// tests rebuilt
154-
test(function () {
148+
test('tests rebuilt', function () {
155149
$structure = Mockery::mock(Nette\Database\IStructure::class);
156150
$structure->shouldReceive('isRebuilt')->andReturn(false);
157151
$structure->shouldReceive('rebuild');
@@ -165,8 +159,7 @@ test(function () {
165159
});
166160

167161

168-
// tests already rebuilt structure
169-
test(function () {
162+
test('tests already rebuilt structure', function () {
170163
$structure = Mockery::mock(Nette\Database\IStructure::class);
171164
$structure->shouldReceive('isRebuilt')->andReturn(true);
172165
$structure->shouldReceive('getHasManyReference')->with('author')->andReturn([])->once();

0 commit comments

Comments
 (0)