Skip to content

Commit d2bfc6a

Browse files
Added comments
1 parent 47a4ccb commit d2bfc6a

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

tests/Unit/ContainerTest.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,37 @@
77

88
class ContainerTest extends \PHPUnit_Framework_TestCase
99
{
10+
/**
11+
* Test that integer is added to container
12+
*/
1013
public function testInteger()
1114
{
1215
$c = new Container(['integer' => 1]);
1316
$this->assertEquals(1, $c->get('integer'));
1417
}
1518

19+
/**
20+
* Test that string is added to container
21+
*/
1622
public function testString()
1723
{
1824
$c = new Container(['string' => 'This is a string']);
1925
$this->assertEquals('This is a string', $c->get('string'));
2026
}
2127

28+
/**
29+
* Test that array is added to container
30+
*/
2231
public function testArray()
2332
{
2433
$c = new Container(['array' => ['one' => 1, 'string' => 'A string']]);
2534
$this->assertArrayHasKey('one', $c->get('array'));
2635
$this->assertArrayHasKey('string', $c->get('array'));
2736
}
2837

38+
/**
39+
* Test that object is added to container
40+
*/
2941
public function testObjects()
3042
{
3143
$entries = [
@@ -38,6 +50,9 @@ public function testObjects()
3850
$this->assertInstanceOf(\SplObjectStorage::class, $c->get('SplObjectStorageInstance'));
3951
}
4052

53+
/**
54+
* Test that closure is added to container
55+
*/
4156
public function testClosure()
4257
{
4358
$entries = [
@@ -53,6 +68,9 @@ public function testClosure()
5368
$this->assertEquals('example', $closure('example'));
5469
}
5570

71+
/**
72+
* Test that a dependency is reachable into the container
73+
*/
5674
public function testDepends()
5775
{
5876
$entries = [];
@@ -67,18 +85,27 @@ public function testDepends()
6785
$this->assertEquals(20, $c->get('multiply'));
6886
}
6987

70-
public function testHasAssertTrue()
88+
/**
89+
* Test that has entry
90+
*/
91+
public function testHasEntry()
7192
{
7293
$c = new Container(['entry' => true]);
7394
$this->assertTrue($c->has('entry'));
7495
}
7596

76-
public function testHasAssertFalse()
97+
/**
98+
* Test that has not an entry
99+
*/
100+
public function testHasNotEntry()
77101
{
78102
$c = new Container();
79103
$this->assertFalse($c->has('not-existing-key'));
80104
}
81105

106+
/**
107+
* Expect a not found exception
108+
*/
82109
public function testNotFoundException()
83110
{
84111
$this->expectException(NotFoundException::class);

0 commit comments

Comments
 (0)