diff --git a/tests/AirInjectorTest.php b/tests/AirInjectorTest.php index 2e27323..37447e7 100644 --- a/tests/AirInjectorTest.php +++ b/tests/AirInjectorTest.php @@ -90,20 +90,6 @@ public function testGetInstance(): void $this->assertInstanceOf($className, $instance); } - public function testGetInstanceSingleton(): void - { - $className = FakeTestClass::class; - $code = 'scriptDir . '/' . str_replace('\\', '_', $className) . '-' . Name::ANY . '.php', - $code - ); - - $instance1 = $this->injector->getInstance($className); - $instance2 = $this->injector->getInstance($className); - $this->assertSame($instance1, $instance2); - } - public function testGetInstanceWithName(): void { $className = FakeTestClass::class; diff --git a/tests/CompileInjectorExtendedScriptInjectorTest.php b/tests/CompileInjectorExtendedScriptInjectorTest.php index 94cb8fc..a3b4ef3 100644 --- a/tests/CompileInjectorExtendedScriptInjectorTest.php +++ b/tests/CompileInjectorExtendedScriptInjectorTest.php @@ -19,18 +19,6 @@ class CompileInjectorExtendedScriptInjectorTest extends TestCase { - /** @var CompileInjector */ - private $injector; - - protected function setUp(): void - { - @mkdir(__DIR__ . '/tmp'); - $this->injector = new CompileInjector( - __DIR__ . '/tmp', - new LazyModule(new FakeCarModule()) - ); - } - public function testGetInstance(): FakeCar { $tmpDir = $this->getTmpDir(__FUNCTION__); @@ -53,8 +41,13 @@ public function testDefaultValueInjected(FakeCar $car): void public function testCompileException(): void { + $injector = new CompileInjector( + __DIR__ . '/tmp', + new LazyModule(new NullModule()) + ); + $this->expectException(Unbound::class); - $this->injector->getInstance('invalid-class'); // @phpstan-ignore-line + $injector->getInstance('invalid-class'); // @phpstan-ignore-line } public function testToPrototype(): void @@ -176,8 +169,13 @@ public function testOnDemandSingleton(): void public function testOnDemandPrototype(): void { + $injector = new CompileInjector( + __DIR__ . '/tmp', + new LazyModule(new NullModule()) + ); + $this->expectException(Unbound::class); // CompileInjector does not support on-demand prototype - $this->injector->getInstance(FakeDependPrototype::class); + $injector->getInstance(FakeDependPrototype::class); } public function testOptional(): void