Skip to content

Commit 6847210

Browse files
author
Bastian Schwarz
committed
Implemented delete task
1 parent 11a524d commit 6847210

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

src/Task/Delete.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+
* Deletes the crontab without asking for confirmation
10+
*
11+
* @psalm-api
12+
*/
13+
final class Delete extends AbstractCrontabCommand implements iTaskWithName, iTaskWithDescription {
14+
15+
public const NAME = 'crontab:delete';
16+
17+
public function getOptions() : array {
18+
return ['-r'];
19+
}
20+
21+
public function getDescription() : string {
22+
return 'Deletes the crontab';
23+
}
24+
25+
public function getName() : string {
26+
return self::NAME;
27+
}
28+
}

test/Task/DeleteTest.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\Delete;
6+
use PHPUnit\Framework\TestCase;
7+
8+
final class DeleteTest extends TestCase {
9+
10+
public function testGetName() : void {
11+
self::assertSame(Delete::NAME, (new Delete())->getName());
12+
}
13+
14+
public function testGetDescription() : void {
15+
self::assertSame('Deletes the crontab', (new Delete())->getDescription());
16+
}
17+
18+
public function testGetOptions() : void {
19+
self::assertSame(['-r'], (new Delete())->getOptions());
20+
}
21+
}

0 commit comments

Comments
 (0)