Cleanup
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Jens True 2023-08-17 07:16:41 +00:00
parent 188a6ad9fa
commit e59e105394
5 changed files with 10 additions and 9 deletions

@ -26,6 +26,11 @@ class CommandShow extends Command
); );
} }
/**
* 1. Read the configuration file.
* 2. For each configured backup print the details
* 3. Exit
*/
protected function execute(InputInterface $input, OutputInterface $output): int protected function execute(InputInterface $input, OutputInterface $output): int
{ {
$sio = new SymfonyStyle($input, $output); $sio = new SymfonyStyle($input, $output);

@ -21,7 +21,7 @@ class Notification
/** /**
* Load multiple configurations * Load multiple configurations
* *
* @param array<array<string>> $config Array of notifier configurations. * @param array<string[]> $config Array of notifier configurations.
*/ */
public function loadMany(array $config): void public function loadMany(array $config): void
{ {

@ -13,6 +13,7 @@ use InvalidArgumentException;
class Ntfy implements NotificationInterface class Ntfy implements NotificationInterface
{ {
private string $topic = 'default'; private string $topic = 'default';
/** /**
* Initialize with configuration. * Initialize with configuration.
* *
@ -45,6 +46,9 @@ class Ntfy implements NotificationInterface
return $this->topic; return $this->topic;
} }
/**
* Push a message with Ntfy
*/
public function send(string $title, string $message): void public function send(string $title, string $message): void
{ {
if (strlen($title) < 1 || strlen($title) >= 256) { if (strlen($title) < 1 || strlen($title) >= 256) {

@ -31,7 +31,6 @@ final class CommandBackupTest extends \PHPUnit\Framework\TestCase
$applicationd->add(new CommandBackup()); $applicationd->add(new CommandBackup());
$command = $applicationd->find('backup'); $command = $applicationd->find('backup');
$commandTester = new CommandTester($command); $commandTester = new CommandTester($command);
$commandTester->execute(['config' => "bad_file"]); $commandTester->execute(['config' => "bad_file"]);
@ -46,7 +45,6 @@ final class CommandBackupTest extends \PHPUnit\Framework\TestCase
$applicationd->add(new CommandBackup()); $applicationd->add(new CommandBackup());
$command = $applicationd->find('backup'); $command = $applicationd->find('backup');
$commandTester = new CommandTester($command); $commandTester = new CommandTester($command);
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
@ -60,7 +58,6 @@ final class CommandBackupTest extends \PHPUnit\Framework\TestCase
$applicationd->add(new CommandBackup()); $applicationd->add(new CommandBackup());
$command = $applicationd->find('backup'); $command = $applicationd->find('backup');
$commandTester = new CommandTester($command); $commandTester = new CommandTester($command);
$commandTester->execute(['config' => "config.example.yml"]); $commandTester->execute(['config' => "config.example.yml"]);
@ -76,7 +73,6 @@ final class CommandBackupTest extends \PHPUnit\Framework\TestCase
$applicationd->add(new CommandBackup()); $applicationd->add(new CommandBackup());
$command = $applicationd->find('backup'); $command = $applicationd->find('backup');
$commandTester = new CommandTester($command); $commandTester = new CommandTester($command);
$commandTester->execute(['config' => "config.example.yml"]); $commandTester->execute(['config' => "config.example.yml"]);
@ -92,7 +88,6 @@ final class CommandBackupTest extends \PHPUnit\Framework\TestCase
$applicationd->add(new CommandBackup()); $applicationd->add(new CommandBackup());
$command = $applicationd->find('backup'); $command = $applicationd->find('backup');
$commandTester = new CommandTester($command); $commandTester = new CommandTester($command);
$commandTester->execute(['config' => "config.example.yml"]); $commandTester->execute(['config' => "config.example.yml"]);

@ -15,12 +15,10 @@ final class CommandShowTest extends \PHPUnit\Framework\TestCase
{ {
public function testInvalidConfig(): void public function testInvalidConfig(): void
{ {
$applicationd = new Application('backup', "1.1.1"); $applicationd = new Application('backup', "1.1.1");
$applicationd->add(new CommandShow()); $applicationd->add(new CommandShow());
$command = $applicationd->find('show'); $command = $applicationd->find('show');
$commandTester = new CommandTester($command); $commandTester = new CommandTester($command);
$commandTester->execute(['config' => "bad_file"]); $commandTester->execute(['config' => "bad_file"]);
@ -37,7 +35,6 @@ final class CommandShowTest extends \PHPUnit\Framework\TestCase
$applicationd->add(new CommandShow()); $applicationd->add(new CommandShow());
$command = $applicationd->find('show'); $command = $applicationd->find('show');
$commandTester = new CommandTester($command); $commandTester = new CommandTester($command);
$commandTester->execute(['config' => "config.example.yml"]); $commandTester->execute(['config' => "config.example.yml"]);