Skip to content

Commit f0249fe

Browse files
Add test to ensure that the model exists method can be used (#406)
1 parent a4faebb commit f0249fe

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/Node/GetAttrTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ public function testGetAttributeOnModel()
4646
$object->attr = null;
4747
$actual = GetAttrNode::attribute($twig, $template->getSourceContext(), $object, "attr", [], Template::ANY_CALL);
4848
$this->assertEquals(null, $actual);
49+
50+
$actual = GetAttrNode::attribute($twig, $template->getSourceContext(), $object, "exists", [], Template::ANY_CALL);
51+
$this->assertEquals(false, $actual);
52+
53+
$object->exists = true;
54+
$actual = GetAttrNode::attribute($twig, $template->getSourceContext(), $object, "exists", [], Template::ANY_CALL);
55+
$this->assertEquals(true, $actual);
4956
}
5057

5158
public function testGetAttributeOnModelWithSandbox()

0 commit comments

Comments
 (0)