| @@ 26-36 (lines=11) @@ | ||
| 23 | $this->container = new Container($this->sm); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function testSet() |
|
| 27 | { |
|
| 28 | $expected = new \stdClass(); |
|
| 29 | $this->container->set('foo', $expected); |
|
| 30 | $this->assertSame($expected, $this->sm->get('foo')); |
|
| 31 | ||
| 32 | $this->container->set('bar', function () { |
|
| 33 | return new \stdClass(); |
|
| 34 | }); |
|
| 35 | $this->assertInstanceOf('stdClass', $this->sm->get('bar')); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function testGet() |
|
| 39 | { |
|
| @@ 116-123 (lines=8) @@ | ||
| 113 | $iterator = $this->container->getIterator(); |
|
| 114 | } |
|
| 115 | ||
| 116 | public function testSignleton() |
|
| 117 | { |
|
| 118 | $expected = new \stdClass(); |
|
| 119 | $this->container->singleton('foo', $expected); |
|
| 120 | $this->sm->has('foo'); |
|
| 121 | $this->assertSame($expected, $this->container->get('foo')); |
|
| 122 | $this->assertSame($expected, $this->sm->get('foo')); |
|
| 123 | } |
|
| 124 | ||
| 125 | public function testSingletonWithCallable() |
|
| 126 | { |
|