Skip to content

Commit 40a8d36

Browse files
committed
tests: test() with description
1 parent 5e38aba commit 40a8d36

File tree

11 files changed

+58
-72
lines changed

11 files changed

+58
-72
lines changed

tests/CodeCoverage/PhpParser.parse.lines-of-code.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,55 +15,55 @@ $parser = new CodeCoverage\PhpParser;
1515
* Assertions assume that every line is considered as a line of code.
1616
*/
1717

18-
test(function () use ($parser) {
18+
test('', function () use ($parser) {
1919
$parsed = $parser->parse('<?php ');
2020

2121
Assert::same(1, $parsed->linesOfCode);
2222
Assert::same(0, $parsed->linesOfComments);
2323
});
2424

2525

26-
test(function () use ($parser) {
26+
test('', function () use ($parser) {
2727
$parsed = $parser->parse("<?php\n");
2828

2929
Assert::same(1, $parsed->linesOfCode);
3030
Assert::same(0, $parsed->linesOfComments);
3131
});
3232

3333

34-
test(function () use ($parser) {
34+
test('', function () use ($parser) {
3535
$parsed = $parser->parse("<?php\n// Comment\n");
3636

3737
Assert::same(2, $parsed->linesOfCode);
3838
Assert::same(1, $parsed->linesOfComments);
3939
});
4040

4141

42-
test(function () use ($parser) {
42+
test('', function () use ($parser) {
4343
$parsed = $parser->parse("<?php\n/* Comment */\n");
4444

4545
Assert::same(2, $parsed->linesOfCode);
4646
Assert::same(1, $parsed->linesOfComments);
4747
});
4848

4949

50-
test(function () use ($parser) {
50+
test('', function () use ($parser) {
5151
$parsed = $parser->parse("<?php\n/** Doc */\n");
5252

5353
Assert::same(2, $parsed->linesOfCode);
5454
Assert::same(1, $parsed->linesOfComments);
5555
});
5656

5757

58-
test(function () use ($parser) {
58+
test('', function () use ($parser) {
5959
$parsed = $parser->parse("<?php\n/* Multi\nline\ncomment */\n");
6060

6161
Assert::same(4, $parsed->linesOfCode);
6262
Assert::same(3, $parsed->linesOfComments);
6363
});
6464

6565

66-
test(function () use ($parser) {
66+
test('', function () use ($parser) {
6767
$parsed = $parser->parse("<?php\n/** Multi\n * doc\n * block\n **/\n");
6868

6969
Assert::same(5, $parsed->linesOfCode);

tests/CodeCoverage/PhpParser.parse.namespaces.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require __DIR__ . '/../../src/CodeCoverage/PhpParser.php';
1212
$parser = new CodeCoverage\PhpParser;
1313

1414

15-
test(function () use ($parser) {
15+
test('', function () use ($parser) {
1616
$parsed = $parser->parse(file_get_contents(__DIR__ . '/fixtures.parse/namespaces.none.php'));
1717

1818
Assert::equal([
@@ -33,7 +33,7 @@ test(function () use ($parser) {
3333
});
3434

3535

36-
test(function () use ($parser) {
36+
test('', function () use ($parser) {
3737
$parsed = $parser->parse(file_get_contents(__DIR__ . '/fixtures.parse/namespaces.php'));
3838

3939
Assert::equal([
@@ -58,7 +58,7 @@ test(function () use ($parser) {
5858
});
5959

6060

61-
test(function () use ($parser) {
61+
test('', function () use ($parser) {
6262
$parsed = $parser->parse(file_get_contents(__DIR__ . '/fixtures.parse/namespaces.braces.php'));
6363

6464
Assert::equal([

tests/Framework/DataProvider.load.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use Tester\DataProvider;
88
require __DIR__ . '/../bootstrap.php';
99

1010

11-
test(function () {
11+
test('', function () {
1212
$expect = [
1313
0 => ['dataset-0'],
1414
1 => ['dataset-1'],
@@ -22,7 +22,7 @@ test(function () {
2222
});
2323

2424

25-
test(function () {
25+
test('', function () {
2626
$expect = [
2727
'bar 1.2.3' => ['a' => '1'],
2828
'bar' => ['b' => '2'],
@@ -33,7 +33,7 @@ test(function () {
3333
});
3434

3535

36-
test(function () {
36+
test('', function () {
3737
Assert::same([], DataProvider::load('fixtures/dataprovider.query.ini', 'non-existent'));
3838
Assert::same([], DataProvider::load('fixtures/dataprovider.query.php', 'non-existent'));
3939
});

tests/Framework/DomQuery.css2Xpath.phpt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@ use Tester\DomQuery;
77

88
require __DIR__ . '/../bootstrap.php';
99

10-
test(function () { // type selectors
10+
test('type selectors', function () {
1111
Assert::same('//*', DomQuery::css2xpath('*'));
1212
Assert::same('//foo', DomQuery::css2xpath('foo'));
1313
});
1414

1515

16-
test(function () { // #ID
16+
test('#ID', function () {
1717
Assert::same("//*[@id='foo']", DomQuery::css2xpath('#foo'));
1818
Assert::same("//*[@id='id']", DomQuery::css2xpath('*#id'));
1919
});
2020

2121

22-
test(function () { // class
22+
test('class', function () {
2323
Assert::same("//*[contains(concat(' ', normalize-space(@class), ' '), ' foo ')]", DomQuery::css2xpath('.foo'));
2424
Assert::same("//*[contains(concat(' ', normalize-space(@class), ' '), ' foo ')]", DomQuery::css2xpath('*.foo'));
2525
Assert::same("//*[contains(concat(' ', normalize-space(@class), ' '), ' foo ')][contains(concat(' ', normalize-space(@class), ' '), ' bar ')]", DomQuery::css2xpath('.foo.bar'));
2626
});
2727

2828

29-
test(function () { // attribute selectors
29+
test('attribute selectors', function () {
3030
Assert::same('//div[@foo]', DomQuery::css2xpath('div[foo]'));
3131
Assert::same("//div[@foo='bar']", DomQuery::css2xpath('div[foo=bar]'));
3232
Assert::same("//*[@foo='bar']", DomQuery::css2xpath('[foo="bar"]'));
@@ -42,14 +42,14 @@ test(function () { // attribute selectors
4242
});
4343

4444

45-
test(function () { // variants
45+
test('variants', function () {
4646
Assert::same("//*[@id='foo']|//*[@id='bar']", DomQuery::css2xpath('#foo, #bar'));
4747
Assert::same("//*[@id='foo']|//*[@id='bar']", DomQuery::css2xpath('#foo,#bar'));
4848
Assert::same("//*[@id='foo']|//*[@id='bar']", DomQuery::css2xpath('#foo ,#bar'));
4949
});
5050

5151

52-
test(function () { // descendant combinator
52+
test('descendant combinator', function () {
5353
Assert::same(
5454
"//div[@id='foo']//*[contains(concat(' ', normalize-space(@class), ' '), ' bar ')]",
5555
DomQuery::css2xpath('div#foo .bar')
@@ -61,18 +61,18 @@ test(function () { // descendant combinator
6161
});
6262

6363

64-
test(function () { // child combinator
64+
test('child combinator', function () {
6565
Assert::same("//div[@id='foo']/span", DomQuery::css2xpath('div#foo>span'));
6666
Assert::same("//div[@id='foo']/span", DomQuery::css2xpath('div#foo > span'));
6767
});
6868

6969

70-
test(function () { // general sibling combinator
70+
test('general sibling combinator', function () {
7171
Assert::same('//div/following-sibling::span', DomQuery::css2xpath('div ~ span'));
7272
});
7373

7474

75-
test(function () { // complex
75+
test('complex', function () {
7676
Assert::same(
7777
"//div[@id='foo']//span[contains(concat(' ', normalize-space(@class), ' '), ' bar ')]"
7878
. "|//*[@id='bar']//li[contains(concat(' ', normalize-space(@class), ' '), ' baz ')]//a",
@@ -81,14 +81,14 @@ test(function () { // complex
8181
});
8282

8383

84-
test(function () { // pseudoclass
84+
test('pseudoclass', function () {
8585
Assert::exception(function () {
8686
DomQuery::css2xpath('a:first-child');
8787
}, InvalidArgumentException::class);
8888
});
8989

9090

91-
test(function () { // adjacent sibling combinator
91+
test('adjacent sibling combinator', function () {
9292
Assert::exception(function () {
9393
DomQuery::css2xpath('div + span');
9494
}, InvalidArgumentException::class);

tests/Framework/Environment.loadData.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $key = count($_SERVER['argv']);
1111
$file = realpath(__DIR__ . '/fixtures/dataprovider.ini');
1212

1313

14-
test(function () use ($key, $file) {
14+
test('', function () use ($key, $file) {
1515
$_SERVER['argv'][$key] = "--dataprovider=0|$file";
1616
Assert::same(['dataset-0'], Environment::loadData());
1717

@@ -29,7 +29,7 @@ test(function () use ($key, $file) {
2929
});
3030

3131

32-
test(function () use ($key, $file) {
32+
test('', function () use ($key, $file) {
3333
$_SERVER['argv'][$key] = "--dataprovider=bar|$file";
3434

3535
Assert::exception(function () {
@@ -38,7 +38,7 @@ test(function () use ($key, $file) {
3838
});
3939

4040

41-
test(function () use ($key, $file) {
41+
test('', function () use ($key, $file) {
4242
unset($_SERVER['argv'][$key]);
4343

4444
Assert::exception(function () {

tests/Framework/FileMock.phpt

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ FileMock::create('');
1313
Assert::contains('mock', stream_get_wrappers());
1414

1515

16-
// Opening non-existing
17-
test(function () {
16+
test('Opening non-existing', function () {
1817
$cases = [
1918
'r' => $tmp = [
2019
[E_USER_WARNING, 'fopen(mock://none): failed to open stream: No such file or directory'],
@@ -42,8 +41,7 @@ test(function () {
4241
});
4342

4443

45-
// Opening existing
46-
test(function () {
44+
test('Opening existing', function () {
4745
FileMock::$files = [];
4846

4947
$cases = [
@@ -70,8 +68,7 @@ test(function () {
7068
});
7169

7270

73-
// Initial cursor position
74-
test(function () {
71+
test('Initial cursor position', function () {
7572
FileMock::$files = [];
7673

7774
$cases = [
@@ -96,8 +93,7 @@ test(function () {
9693
});
9794

9895

99-
// Truncation on open
100-
test(function () {
96+
test('Truncation on open', function () {
10197
FileMock::$files = [];
10298

10399
$cases = [
@@ -126,8 +122,7 @@ test(function () {
126122
}
127123
});
128124

129-
// Writing position after open
130-
test(function () {
125+
test('Writing position after open', function () {
131126
FileMock::$files = [];
132127

133128
$cases = [
@@ -158,8 +153,7 @@ test(function () {
158153
});
159154

160155

161-
// Filesystem functions
162-
test(function () {
156+
test('Filesystem functions', function () {
163157
$f = fopen($name = FileMock::create('', 'txt'), 'w+');
164158

165159
Assert::match('%a%.txt', $name);
@@ -206,8 +200,7 @@ test(function () {
206200
});
207201

208202

209-
// Unlink
210-
test(function () {
203+
test('Unlink', function () {
211204
fopen($name = Tester\FileMock::create('foo'), 'r');
212205
Assert::true(unlink($name));
213206
Assert::false(@unlink($name));
@@ -217,20 +210,17 @@ test(function () {
217210
});
218211

219212

220-
// Runtime include
221-
test(function () {
213+
test('Runtime include', function () {
222214
Assert::same(123, require FileMock::create('<?php return 123;'));
223215
});
224216

225217

226-
// Locking
227-
test(function () {
218+
test('Locking', function () {
228219
Assert::false(flock(fopen(FileMock::create(''), 'w'), LOCK_EX));
229220
});
230221

231222

232-
// Position handling across modes
233-
test(function () {
223+
test('Position handling across modes', function () {
234224
$modes = ['r', 'r+', 'w', 'w+', 'a', 'a+', 'c', 'c+'];
235225
$pathReal = __DIR__ . '/real-file.txt';
236226

@@ -264,8 +254,7 @@ test(function () {
264254
});
265255

266256

267-
// touch
268-
test(function () {
257+
test('touch', function () {
269258
fopen($name = Tester\FileMock::create('foo'), 'r');
270259
Assert::true(touch($name));
271260
});

0 commit comments

Comments
 (0)