From a96a985b89e509a809c5dea6ad177061e6d50bb6 Mon Sep 17 00:00:00 2001 From: Andy Vaughn Date: Fri, 11 Dec 2020 17:19:32 -0800 Subject: [PATCH] test exception PSR-11 compatibility --- tests/OpenContainerTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/OpenContainerTest.php b/tests/OpenContainerTest.php index d90ab67..9127638 100644 --- a/tests/OpenContainerTest.php +++ b/tests/OpenContainerTest.php @@ -19,6 +19,8 @@ use modethirteen\OpenContainer\OpenContainerCannotBuildDeferredInstanceException; use modethirteen\OpenContainer\OpenContainerNotRegisteredInContainerException; use PHPUnit\Framework\TestCase; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; /** * Class OpenContainerTest @@ -250,4 +252,14 @@ public function Can_check_if_dependency_is_resolved(IDependencyContainer $contai static::assertTrue($result2); } } + + /** + * @test + */ + public function Exceptions_are_PSR11_compatible() : void { + + // assert + static::assertInstanceOf(NotFoundExceptionInterface::class, new OpenContainerNotRegisteredInContainerException('foo')); + static::assertInstanceOf(ContainerExceptionInterface::class, new OpenContainerCannotBuildDeferredInstanceException('foo')); + } }