Skip to content

Commit 11a524d

Browse files
author
Bastian Schwarz
committed
Implemented show task
1 parent e10a9f6 commit 11a524d

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

src/Task/Show.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace de\codenamephp\deployer\crontab\Task;
4+
5+
use de\codenamephp\deployer\base\task\iTaskWithDescription;
6+
use de\codenamephp\deployer\base\task\iTaskWithName;
7+
8+
/**
9+
* Lists the crontab ... should have been called 'List' but that is a reserved word
10+
*
11+
* @psalm-api
12+
*/
13+
final class Show extends AbstractCrontabCommand implements iTaskWithName, iTaskWithDescription {
14+
15+
public const NAME = 'crontab:show';
16+
17+
public function getOptions() : array {
18+
return ['-l'];
19+
}
20+
21+
public function getDescription() : string {
22+
return 'Shows the crontab';
23+
}
24+
25+
public function getName() : string {
26+
return self::NAME;
27+
}
28+
}

test/Task/ShowTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace de\codenamephp\deployer\crontab\test\Task;
4+
5+
use de\codenamephp\deployer\crontab\Task\Show;
6+
use PHPUnit\Framework\TestCase;
7+
8+
final class ShowTest extends TestCase {
9+
10+
public function testGetName() : void {
11+
self::assertSame(Show::NAME, (new Show())->getName());
12+
}
13+
14+
public function testGetOptions() : void {
15+
self::assertSame(['-l'], (new Show())->getOptions());
16+
}
17+
18+
public function testGetDescription() : void {
19+
self::assertSame('Shows the crontab', (new Show())->getDescription());
20+
}
21+
}

0 commit comments

Comments
 (0)