diff --git a/tests/AttributeHandling/ResolverFactory/ContainerAttributeResolverFactoryTest.php b/tests/AttributeHandling/ResolverFactory/ContainerAttributeResolverFactoryTest.php new file mode 100644 index 0000000..39551f3 --- /dev/null +++ b/tests/AttributeHandling/ResolverFactory/ContainerAttributeResolverFactoryTest.php @@ -0,0 +1,50 @@ + $resolver]); + $factory = new ContainerAttributeResolverFactory($container); + + $result = $factory->create($attribute); + + $this->assertSame($resolver, $result); + } + + public function testResolverIsAttributeItself(): void + { + $attribute = new CustomValue('test'); + $container = new SimpleContainer(); + $factory = new ContainerAttributeResolverFactory($container); + + $result = $factory->create($attribute); + + $this->assertSame($attribute, $result); + } + + public function testResolverNotExists(): void + { + $attribute = new Counter('test'); + $container = new SimpleContainer(); + $factory = new ContainerAttributeResolverFactory($container); + + $this->expectException(AttributeResolverNonInstantiableException::class); + $this->expectExceptionMessage('Class "' . CounterResolver::class . '" does not exist.'); + $factory->create($attribute); + } +}