Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
theseer committed Jul 27, 2023
1 parent ef39913 commit 971d402
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/viewmodel/ViewModelRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,23 @@ public function getTest() {
});
}

public function testNonObjectResultForTypeOfMethodOnConditionContextThrowsException(): void {
$dom = new DOMDocument();
$dom->loadXML('<?xml version="1.0" ?><root property="test" typeof="A" />');

$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('<?xml version="1.0" ?><root property="test" typeof="A" />');
Expand Down

0 comments on commit 971d402

Please sign in to comment.