Skip to content

Commit 93490c4

Browse files
committed
tests: removed function test()
1 parent eff4062 commit 93490c4

33 files changed

+336
-340
lines changed

tests/Iterators/CachingIterator.basic.phpt

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

1313

14-
test(function () { // ==> Two items in array
14+
(function () { // ==> Two items in array
1515

1616
$arr = ['Nette', 'Framework'];
1717

@@ -36,10 +36,10 @@ test(function () { // ==> Two items in array
3636
Assert::false($iterator->isLast());
3737
Assert::same(1, $iterator->getCounter());
3838
Assert::false($iterator->isEmpty());
39-
});
39+
})();
4040

4141

42-
test(function () {
42+
(function () {
4343
$arr = ['Nette'];
4444

4545
$iterator = new Iterators\CachingIterator($arr);
@@ -57,10 +57,10 @@ test(function () {
5757
Assert::true($iterator->isLast());
5858
Assert::same(1, $iterator->getCounter());
5959
Assert::false($iterator->isEmpty());
60-
});
60+
})();
6161

6262

63-
test(function () {
63+
(function () {
6464
$arr = [];
6565

6666
$iterator = new Iterators\CachingIterator($arr);
@@ -70,4 +70,4 @@ test(function () {
7070
Assert::true($iterator->isLast());
7171
Assert::same(0, $iterator->getCounter());
7272
Assert::true($iterator->isEmpty());
73-
});
73+
})();

tests/Iterators/CachingIterator.construct.phpt

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

1313

14-
test(function () { // ==> array
14+
(function () { // ==> array
1515
$arr = ['Nette', 'Framework'];
1616
$tmp = [];
1717
foreach (new Iterators\CachingIterator($arr) as $k => $v) {
@@ -21,10 +21,10 @@ test(function () { // ==> array
2121
'0 => Nette',
2222
'1 => Framework',
2323
], $tmp);
24-
});
24+
})();
2525

2626

27-
test(function () { // ==> stdClass
27+
(function () { // ==> stdClass
2828
$arr = (object) ['Nette', 'Framework'];
2929
$tmp = [];
3030
foreach (new Iterators\CachingIterator($arr) as $k => $v) {
@@ -34,10 +34,10 @@ test(function () { // ==> stdClass
3434
'0 => Nette',
3535
'1 => Framework',
3636
], $tmp);
37-
});
37+
})();
3838

3939

40-
test(function () { // ==> IteratorAggregate
40+
(function () { // ==> IteratorAggregate
4141
$arr = new ArrayObject(['Nette', 'Framework']);
4242
$tmp = [];
4343
foreach (new Iterators\CachingIterator($arr) as $k => $v) {
@@ -47,9 +47,10 @@ test(function () { // ==> IteratorAggregate
4747
'0 => Nette',
4848
'1 => Framework',
4949
], $tmp);
50-
});
50+
})();
5151

52-
test(function () { // ==> Iterator
52+
53+
(function () { // ==> Iterator
5354
$arr = new ArrayObject(['Nette', 'Framework']);
5455
$tmp = [];
5556
foreach (new Iterators\CachingIterator($arr->getIterator()) as $k => $v) {
@@ -59,10 +60,10 @@ test(function () { // ==> Iterator
5960
'0 => Nette',
6061
'1 => Framework',
6162
], $tmp);
62-
});
63+
})();
6364

6465

65-
test(function () { // ==> SimpleXMLElement
66+
(function () { // ==> SimpleXMLElement
6667
$arr = new SimpleXMLElement('<feed><item>Nette</item><item>Framework</item></feed>');
6768
$tmp = [];
6869
foreach (new Iterators\CachingIterator($arr) as $k => $v) {
@@ -72,15 +73,15 @@ test(function () { // ==> SimpleXMLElement
7273
'item => Nette',
7374
'item => Framework',
7475
], $tmp);
75-
});
76+
})();
7677

7778

78-
test(function () { // ==> object
79+
(function () { // ==> object
7980
Assert::exception(function () {
8081
$arr = dir('.');
8182
foreach (new Iterators\CachingIterator($arr) as $k => $v);
8283
}, InvalidArgumentException::class, NULL);
83-
});
84+
})();
8485

8586

8687
class RecursiveIteratorAggregate implements IteratorAggregate
@@ -92,7 +93,7 @@ class RecursiveIteratorAggregate implements IteratorAggregate
9293
}
9394

9495

95-
test(function () { // ==> recursive IteratorAggregate
96+
(function () { // ==> recursive IteratorAggregate
9697
$arr = new RecursiveIteratorAggregate;
9798
$tmp = [];
9899
foreach (new Iterators\CachingIterator($arr) as $k => $v) {
@@ -102,4 +103,4 @@ test(function () { // ==> recursive IteratorAggregate
102103
'0 => Nette',
103104
'1 => Framework',
104105
], $tmp);
105-
});
106+
})();

tests/Iterators/CachingIterator.width.phpt

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

1313

14-
test(function () {
14+
(function () {
1515
$arr = ['The', 'Nette', 'Framework'];
1616

1717
$iterator = new Iterators\CachingIterator($arr);
@@ -46,15 +46,15 @@ test(function () {
4646

4747
$iterator->next();
4848
Assert::false($iterator->valid());
49-
});
49+
})();
5050

5151

52-
test(function () {
52+
(function () {
5353
$iterator = new Iterators\CachingIterator([]);
5454
Assert::false($iterator->isFirst(0));
5555
Assert::true($iterator->isLast(0));
5656
Assert::false($iterator->isFirst(1));
5757
Assert::true($iterator->isLast(1));
5858
Assert::false($iterator->isFirst(2));
5959
Assert::true($iterator->isLast(2));
60-
});
60+
})();

tests/Utils/ArrayHash.phpt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Person
2828
}
2929

3030

31-
test(function () {
31+
(function () {
3232
$list = new ArrayHash;
3333
$jack = new Person('Jack');
3434
$mary = new Person('Mary');
@@ -72,10 +72,10 @@ test(function () {
7272
Assert::same([
7373
'm' => $mary,
7474
], iterator_to_array($list));
75-
});
75+
})();
7676

7777

78-
test(function () {
78+
(function () {
7979
$mary = new Person('Mary');
8080
$list = ArrayHash::from([
8181
'm' => $mary,
@@ -86,10 +86,10 @@ test(function () {
8686
], FALSE);
8787
Assert::type(Nette\Utils\ArrayHash::class, $list);
8888
Assert::type('array', $list['children']);
89-
});
89+
})();
9090

9191

92-
test(function () {
92+
(function () {
9393
$mary = new Person('Mary');
9494
$list = ArrayHash::from([
9595
'm' => $mary,
@@ -114,10 +114,10 @@ test(function () {
114114
'children' => $list['children'],
115115
'c' => 'Jim',
116116
], iterator_to_array(new RecursiveIteratorIterator($list, RecursiveIteratorIterator::SELF_FIRST)));
117-
});
117+
})();
118118

119119

120-
test(function () { // numeric fields
120+
(function () { // numeric fields
121121
$row = ArrayHash::from([1, 2]);
122122

123123
foreach ($row as $key => $value) {
@@ -159,19 +159,19 @@ test(function () { // numeric fields
159159
Assert::false(isset($row->{'3'}));
160160
Assert::false(isset($row[3]));
161161
Assert::false(isset($row['3']));
162-
});
162+
})();
163163

164164

165-
test(function () { // null fields
165+
(function () { // null fields
166166
$row = ArrayHash::from(['null' => NULL]);
167167
Assert::null($row->null);
168168
Assert::null($row['null']);
169169
Assert::false(isset($row->null));
170170
Assert::false(isset($row['null']));
171-
});
171+
})();
172172

173173

174-
test(function () { // undeclared fields
174+
(function () { // undeclared fields
175175
$row = new ArrayHash;
176176
Assert::error(function () use ($row) {
177177
$row->undef;
@@ -180,13 +180,13 @@ test(function () { // undeclared fields
180180
Assert::error(function () use ($row) {
181181
$row['undef'];
182182
}, E_NOTICE, 'Undefined property: Nette\Utils\ArrayHash::$undef');
183-
});
183+
})();
184184

185185

186-
test(function () { // PHP 7 changed behavior https://3v4l.org/2A1pf
186+
(function () { // PHP 7 changed behavior https://3v4l.org/2A1pf
187187
$hash = ArrayHash::from([1, 2, 3]);
188188
foreach ($hash as $key => $value) {
189189
unset($hash->$key);
190190
}
191191
Assert::count(0, $hash);
192-
});
192+
})();

tests/Utils/ArrayList.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Person
2828
}
2929

3030

31-
test(function () {
31+
(function () {
3232
$list = new ArrayList;
3333
$jack = new Person('Jack');
3434
$mary = new Person('Mary');
@@ -74,4 +74,4 @@ test(function () {
7474

7575
$list->prepend('First');
7676
Assert::same('First', $list[0], 'Value "First" should be on the start of the array');
77-
});
77+
})();

tests/Utils/Arrays.every().phpt

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

1313

14-
test(function () {
14+
(function () {
1515
$arr = [];
1616
$log = [];
1717
$res = Arrays::every(
@@ -20,9 +20,9 @@ test(function () {
2020
);
2121
Assert::true($res);
2222
Assert::same([], $log);
23-
});
23+
})();
2424

25-
test(function () {
25+
(function () {
2626
$arr = [];
2727
$log = [];
2828
$res = Arrays::every(
@@ -31,9 +31,9 @@ test(function () {
3131
);
3232
Assert::true($res);
3333
Assert::same([], $log);
34-
});
34+
})();
3535

36-
test(function () {
36+
(function () {
3737
$arr = ['a', 'b'];
3838
$log = [];
3939
$res = Arrays::every(
@@ -42,9 +42,9 @@ test(function () {
4242
);
4343
Assert::false($res);
4444
Assert::same([['a', 0, $arr]], $log);
45-
});
45+
})();
4646

47-
test(function () {
47+
(function () {
4848
$arr = ['a', 'b'];
4949
$log = [];
5050
$res = Arrays::every(
@@ -53,9 +53,9 @@ test(function () {
5353
);
5454
Assert::true($res);
5555
Assert::same([['a', 0, $arr], ['b', 1, $arr]], $log);
56-
});
56+
})();
5757

58-
test(function () {
58+
(function () {
5959
$arr = ['a', 'b'];
6060
$log = [];
6161
$res = Arrays::every(
@@ -64,9 +64,9 @@ test(function () {
6464
);
6565
Assert::false($res);
6666
Assert::same([['a', 0, $arr], ['b', 1, $arr]], $log);
67-
});
67+
})();
6868

69-
test(function () {
69+
(function () {
7070
$arr = ['x' => 'a', 'y' => 'b'];
7171
$log = [];
7272
$res = Arrays::every(
@@ -75,4 +75,4 @@ test(function () {
7575
);
7676
Assert::true($res);
7777
Assert::same([['a', 'x', $arr], ['b', 'y', $arr]], $log);
78-
});
78+
})();

tests/Utils/Arrays.get().phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $arr = [
1919
],
2020
];
2121

22-
test(function () use ($arr) { // Single item
22+
(function () use ($arr) { // Single item
2323

2424
Assert::same('first', Arrays::get($arr, NULL));
2525
Assert::same('second', Arrays::get($arr, 1));
@@ -28,10 +28,10 @@ test(function () use ($arr) { // Single item
2828
Assert::exception(function () use ($arr) {
2929
Arrays::get($arr, 'undefined');
3030
}, Nette\InvalidArgumentException::class, "Missing item 'undefined'.");
31-
});
31+
})();
3232

3333

34-
test(function () use ($arr) { // Traversing
34+
(function () use ($arr) { // Traversing
3535

3636
Assert::same([
3737
'' => 'first',
@@ -43,4 +43,4 @@ test(function () use ($arr) { // Traversing
4343

4444

4545
Assert::same('third', Arrays::get($arr, [7, 'item']));
46-
});
46+
})();

0 commit comments

Comments
 (0)