1 | <?php |
||
14 | final class ContainerFactoryTest extends TestCase |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $tempFilename; |
||
20 | |||
21 | public function setUp() : void |
||
22 | { |
||
23 | $this->tempFilename = tempnam(sys_get_temp_dir(), str_replace('\\', '_', __CLASS__) . '_'); |
||
24 | } |
||
25 | |||
26 | public function tearDown() : void |
||
27 | { |
||
28 | if (file_exists($this->tempFilename)) { |
||
29 | unlink($this->tempFilename); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | public function testFactoryThrowsExceptionWhenFileDoesNotReturnContainer() : void |
||
34 | { |
||
35 | file_put_contents( |
||
36 | $this->tempFilename, |
||
37 | "<?php return new \stdClass();" |
||
38 | ); |
||
39 | |||
40 | $this->expectException(NotAPsrContainer::class); |
||
41 | ContainerFactory::createContainerFromIncludedFile($this->tempFilename); |
||
42 | } |
||
43 | |||
44 | public function testFactoryReturnsContainerIfIncluded() : void |
||
57 | } |
||
58 |