Skip to content

Commit 65c7539

Browse files
committed
Test auto toggle
1 parent cc01e4d commit 65c7539

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/MenuItem/CheckableItemTest.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,31 @@ public function testGetSelectAction() : void
2424
};
2525
$item = new CheckableItem('Item', $callable);
2626

27-
$cliMenu = $this->getMockBuilder(CLiMenu::class)
27+
$cliMenu = $this->getMockBuilder(CliMenu::class)
2828
->disableOriginalConstructor()
2929
->getMock();
3030

3131
$this->assertSame($callable(), $item->getSelectAction()($cliMenu));
3232
}
3333

34+
public function testSelectActionTogglesItem() : void
35+
{
36+
$callable = function () {
37+
};
38+
39+
$item = new CheckableItem('Item', $callable);
40+
41+
self::assertFalse($item->getChecked());
42+
43+
$cliMenu = $this->getMockBuilder(CliMenu::class)
44+
->disableOriginalConstructor()
45+
->getMock();
46+
47+
$item->getSelectAction()($cliMenu);
48+
49+
self::assertTrue($item->getChecked());
50+
}
51+
3452
public function testShowsItemExtra() : void
3553
{
3654
$item = new CheckableItem('Item', function () {

0 commit comments

Comments
 (0)