diff --git a/tests/Fake/fake-app/src/Module/BadModule.php b/tests/Fake/fake-app/src/Module/BadModule.php new file mode 100644 index 00000000..e90e8eda --- /dev/null +++ b/tests/Fake/fake-app/src/Module/BadModule.php @@ -0,0 +1,29 @@ +bind(ThrowableHandlerInterface::class)->toInstance(new class implements ThrowableHandlerInterface { + public function handle(Throwable $e, RouterMatch $request): ThrowableHandlerInterface + { + } + public function transfer(): void + { + } + }); + } +} diff --git a/tests/Injector/PackageInjectorTest.php b/tests/Injector/PackageInjectorTest.php index fd98addc..0731c00f 100644 --- a/tests/Injector/PackageInjectorTest.php +++ b/tests/Injector/PackageInjectorTest.php @@ -52,13 +52,13 @@ protected function configure(): void $this->assertInstanceOf(FakeDep2::class, $page->foo); } - public function testWithNullCacheWarning(): void + public function testUnserializableRootObject(): void { set_error_handler(static function (int $errno, string $errstr): void { throw new Exception($errstr, $errno); }, E_USER_WARNING); $this->expectExceptionMessage('Failed to verify the injector cache.'); - $injector = PackageInjector::getInstance(new Meta('FakeVendor\HelloWorld'), 'app', new NullAdapter()); + $injector = PackageInjector::getInstance(new Meta('FakeVendor\HelloWorld'), 'bad-app', new NullAdapter()); $this->assertInstanceOf(InjectorInterface::class, $injector); restore_error_handler(); }