Skip to content

Commit 698e9e3

Browse files
committed
Adds testGetSelectAction()
1 parent 076d351 commit 698e9e3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/MenuItem/CheckableItemTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PhpSchool\CliMenuTest\MenuItem;
44

5+
use PhpSchool\CliMenu\CliMenu;
56
use PhpSchool\CliMenu\MenuItem\CheckableItem;
67
use PhpSchool\CliMenu\MenuStyle;
78
use PhpSchool\Terminal\Terminal;
@@ -16,6 +17,20 @@ public function testCanSelectIsTrue() : void
1617
$this->assertTrue($item->canSelect());
1718
}
1819

20+
public function testGetSelectAction() : void
21+
{
22+
$callable = function () {
23+
return 'callable is called';
24+
};
25+
$item = new CheckableItem('Item', $callable);
26+
27+
$cliMenu = $this->getMockBuilder(CLiMenu::class)
28+
->disableOriginalConstructor()
29+
->getMock();
30+
31+
$this->assertSame($callable(), $item->getSelectAction()($cliMenu));
32+
}
33+
1934
public function testShowsItemExtra() : void
2035
{
2136
$item = new CheckableItem('Item', function () {

0 commit comments

Comments
 (0)