Skip to content

Commit c6cc39e

Browse files
author
Bastian Schwarz
committed
Added HasOption
1 parent ac6ede9 commit c6cc39e

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/Task/Show.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @psalm-api
1212
*/
13-
final class Show extends AbstractCrontabCommand implements iTaskWithName, iTaskWithDescription {
13+
final class Show extends AbstractCrontabCommand implements iTaskWithName, iTaskWithDescription, HasOptionsInterface {
1414

1515
public const NAME = 'crontab:show';
1616

test/Task/ShowTest.php

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

33
namespace de\codenamephp\deployer\crontab\test\Task;
44

5+
use de\codenamephp\deployer\command\runner\iRunner;
6+
use de\codenamephp\deployer\crontab\Command\CrontabCommandFactoryInterface;
57
use de\codenamephp\deployer\crontab\Task\Show;
68
use PHPUnit\Framework\TestCase;
79

@@ -18,4 +20,11 @@ public function testGetOptions() : void {
1820
public function testGetDescription() : void {
1921
self::assertSame('Shows the crontab', (new Show())->getDescription());
2022
}
23+
24+
public function test__invoke() : void {
25+
$crontabCommandFactory = $this->createMock(CrontabCommandFactoryInterface::class);
26+
$crontabCommandFactory->expects(self::once())->method('build')->with(['-l']);
27+
28+
(new Show(crontabCommandFactory: $crontabCommandFactory, commandRunner: $this->createMock(iRunner::class)))->__invoke();
29+
}
2130
}

0 commit comments

Comments
 (0)