Skip to content

Commit b74de2e

Browse files
committed
Added unit test for Twig extension can method
1 parent cba2910 commit b74de2e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/Finite/Test/Extension/Twig/FiniteExtensionTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ protected function setUp()
3131
'state' => '{{ finite_state(object) }}',
3232
'transitions' => '{% for transition in finite_transitions(object) %}{{ transition }}{% endfor %}',
3333
'properties' => '{% for property, val in finite_properties(object) %}{{ property }}{% endfor %}',
34-
'has' => '{{ finite_has(object, property) ? "yes" : "no" }}'
34+
'has' => '{{ finite_has(object, property) ? "yes" : "no" }}',
35+
'can' => '{{ finite_can(object, transition) ? "yes" : "no" }}'
3536
)
3637
)
3738
);
@@ -72,6 +73,12 @@ public function testHas()
7273
$this->assertSame('no', $this->env->render('has', array('object' => $this->getObjectMock(), 'property' => 'baz')));
7374
}
7475

76+
public function testCan()
77+
{
78+
$this->assertSame('yes', $this->env->render('can', array('object' => $this->getObjectMock(), 'transition' => 't12')));
79+
$this->assertSame('no', $this->env->render('can', array('object' => $this->getObjectMock(), 'transition' => 't23')));
80+
}
81+
7582
public function getObjectMock()
7683
{
7784
$mock = $this->getMock('Finite\StatefulInterface');

0 commit comments

Comments
 (0)