diff --git a/tests/viewmodel/ViewModelRendererTest.php b/tests/viewmodel/ViewModelRendererTest.php index 240038e..501d29e 100644 --- a/tests/viewmodel/ViewModelRendererTest.php +++ b/tests/viewmodel/ViewModelRendererTest.php @@ -231,6 +231,23 @@ public function getTest() { }); } + public function testNonObjectResultForTypeOfMethodOnConditionContextThrowsException(): void { + $dom = new DOMDocument(); + $dom->loadXML(''); + + $renderer = new ViewModelRenderer(); + + $this->expectException(ViewModelRendererException::class); + $this->expectExceptionCode(ViewModelRendererException::WrongTypeForTypeOf); + $renderer->render($dom->documentElement, new class { + public function getTest() { + return [ + 'test' + ]; + } + }); + } + public function testNoExsitingTypeForRequestedTypeOfMethodOnConditionContextThrowsException(): void { $dom = new DOMDocument(); $dom->loadXML('');