Skip to content

Commit d6d3382

Browse files
authored
Merge pull request #645 from pierresh/return-type-in-test
test: add missing return types in test
2 parents 0abf1b9 + 840833e commit d6d3382

30 files changed

+307
-316
lines changed

tests/AutoloadTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected function setUp(): void
1919
}
2020

2121
// Autoload a class
22-
public function testAutoload()
22+
public function testAutoload(): void
2323
{
2424
$this->app->register('user', User::class);
2525

@@ -33,7 +33,7 @@ public function testAutoload()
3333
}
3434

3535
// Check autoload failure
36-
public function testMissingClass()
36+
public function testMissingClass(): void
3737
{
3838
$test = null;
3939
$this->app->register('test', 'NonExistentClass');

tests/CollectionTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,39 @@ protected function setUp(): void
1717
}
1818

1919
// Get an item
20-
public function testGet()
20+
public function testGet(): void
2121
{
2222
$this->assertEquals(1, $this->collection->a);
2323
}
2424

2525
// Set an item
26-
public function testSet()
26+
public function testSet(): void
2727
{
2828
$this->collection->c = 3;
2929
$this->assertEquals(3, $this->collection->c);
3030
}
3131

3232
// Check if an item exists
33-
public function testExists()
33+
public function testExists(): void
3434
{
3535
$this->assertTrue(isset($this->collection->a));
3636
}
3737

3838
// Unset an item
39-
public function testUnset()
39+
public function testUnset(): void
4040
{
4141
unset($this->collection->a);
4242
$this->assertFalse(isset($this->collection->a));
4343
}
4444

4545
// Count items
46-
public function testCount()
46+
public function testCount(): void
4747
{
4848
$this->assertEquals(2, count($this->collection));
4949
}
5050

5151
// Iterate through items
52-
public function testIterate()
52+
public function testIterate(): void
5353
{
5454
$items = [];
5555
foreach ($this->collection as $key => $value) {
@@ -59,39 +59,39 @@ public function testIterate()
5959
$this->assertEquals(['a' => 1, 'b' => 2], $items);
6060
}
6161

62-
public function testJsonSerialize()
62+
public function testJsonSerialize(): void
6363
{
6464
$this->assertEquals(['a' => 1, 'b' => 2], $this->collection->jsonSerialize());
6565
}
6666

67-
public function testOffsetSetWithNullOffset()
67+
public function testOffsetSetWithNullOffset(): void
6868
{
6969
$this->collection->offsetSet(null, 3);
7070
$this->assertEquals(3, $this->collection->offsetGet(0));
7171
}
7272

73-
public function testOffsetExists()
73+
public function testOffsetExists(): void
7474
{
7575
$this->collection->a = 1;
7676
$this->assertTrue($this->collection->offsetExists('a'));
7777
}
7878

79-
public function testOffsetUnset()
79+
public function testOffsetUnset(): void
8080
{
8181
$this->collection->a = 1;
8282
$this->assertTrue($this->collection->offsetExists('a'));
8383
$this->collection->offsetUnset('a');
8484
$this->assertFalse($this->collection->offsetExists('a'));
8585
}
8686

87-
public function testKeys()
87+
public function testKeys(): void
8888
{
8989
$this->collection->a = 1;
9090
$this->collection->b = 2;
9191
$this->assertEquals(['a', 'b'], $this->collection->keys());
9292
}
9393

94-
public function testClear()
94+
public function testClear(): void
9595
{
9696
$this->collection->a = 1;
9797
$this->collection->b = 2;

tests/DispatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function testExecuteStringClassDefaultContainerButForgotInjectingEngine()
331331
$result = $this->dispatcher->execute([ContainerDefault::class, 'testTheContainer']);
332332
}
333333

334-
public function testContainerDicePdoWrapperTestBadParams()
334+
public function testContainerDicePdoWrapperTestBadParams(): void
335335
{
336336
$dice = new \Dice\Dice();
337337
$this->dispatcher->setContainerHandler(function ($class, $params) use ($dice) {

tests/DocExamplesTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function tearDown(): void
2727
Flight::clear();
2828
}
2929

30-
public function testMapNotFoundMethod()
30+
public function testMapNotFoundMethod(): void
3131
{
3232
Flight::map('notFound', function () {
3333
Flight::json([], 404);
@@ -45,7 +45,7 @@ public function testMapNotFoundMethod()
4545
$this->assertEquals('[]', Flight::response()->getBody());
4646
}
4747

48-
public function testMapNotFoundMethodV2OutputBuffering()
48+
public function testMapNotFoundMethodV2OutputBuffering(): void
4949
{
5050
Flight::map('notFound', function () {
5151
Flight::json([], 404);
@@ -64,7 +64,7 @@ public function testMapNotFoundMethodV2OutputBuffering()
6464
$this->assertEquals('[]', Flight::response()->getBody());
6565
}
6666

67-
public function testMapErrorMethod()
67+
public function testMapErrorMethod(): void
6868
{
6969
Flight::map('error', function (Throwable $error) {
7070
// Handle error
@@ -75,7 +75,7 @@ public function testMapErrorMethod()
7575
$this->expectOutputString('Custom: Error');
7676
}
7777

78-
public function testGetRouterStatically()
78+
public function testGetRouterStatically(): void
7979
{
8080
$router = Flight::router();
8181
Flight::request()->method = 'GET';

0 commit comments

Comments
 (0)