diff --git a/tests/CompilerTest.php b/tests/CompilerTest.php index 151505f9..2dbb2f8f 100644 --- a/tests/CompilerTest.php +++ b/tests/CompilerTest.php @@ -353,4 +353,11 @@ public function testCompileMultipleFile(): void $bind = (new Bind())->bindInterceptors('foo', [new FakeDoubleInterceptor()]); $compiler->newInstance(FakeTwoClass::class, [], $bind); } + + public function testNewInstanceWithAnonymousClass(): void + { + $mock = $this->compiler->newInstance(FakeAnonymousClass::class, [], $this->bind); + $this->assertInstanceOf(FakeAnonymousClass::class, $mock); + $this->assertInstanceOf(WeavedInterface::class, $mock); + } } diff --git a/tests/Fake/FakeAnonymousClass.php b/tests/Fake/FakeAnonymousClass.php new file mode 100644 index 00000000..811c39c3 --- /dev/null +++ b/tests/Fake/FakeAnonymousClass.php @@ -0,0 +1,13 @@ +