This commit is contained in:
37
composer.lock
generated
37
composer.lock
generated
@ -3297,16 +3297,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "1.10.28",
|
"version": "1.10.29",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpstan.git",
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
"reference": "e4545b55904ebef470423d3ddddb74fa7325497a"
|
"reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e4545b55904ebef470423d3ddddb74fa7325497a",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1",
|
||||||
"reference": "e4545b55904ebef470423d3ddddb74fa7325497a",
|
"reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -3355,7 +3355,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-08-08T12:33:42+00:00"
|
"time": "2023-08-14T13:24:11+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
@ -3679,16 +3679,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "10.3.1",
|
"version": "10.3.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "d442ce7c4104d5683c12e67e4dcb5058159e9804"
|
"reference": "0dafb1175c366dd274eaa9a625e914451506bcd1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d442ce7c4104d5683c12e67e4dcb5058159e9804",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0dafb1175c366dd274eaa9a625e914451506bcd1",
|
||||||
"reference": "d442ce7c4104d5683c12e67e4dcb5058159e9804",
|
"reference": "0dafb1175c366dd274eaa9a625e914451506bcd1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -3760,7 +3760,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.1"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.2"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -3776,7 +3776,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-08-04T06:48:08+00:00"
|
"time": "2023-08-15T05:34:23+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/cli-parser",
|
"name": "sebastian/cli-parser",
|
||||||
@ -3947,16 +3947,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/comparator",
|
"name": "sebastian/comparator",
|
||||||
"version": "5.0.0",
|
"version": "5.0.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/comparator.git",
|
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||||
"reference": "72f01e6586e0caf6af81297897bd112eb7e9627c"
|
"reference": "2db5010a484d53ebf536087a70b4a5423c102372"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/72f01e6586e0caf6af81297897bd112eb7e9627c",
|
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372",
|
||||||
"reference": "72f01e6586e0caf6af81297897bd112eb7e9627c",
|
"reference": "2db5010a484d53ebf536087a70b4a5423c102372",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -3967,7 +3967,7 @@
|
|||||||
"sebastian/exporter": "^5.0"
|
"sebastian/exporter": "^5.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^10.0"
|
"phpunit/phpunit": "^10.3"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
@ -4011,7 +4011,8 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/comparator/issues",
|
"issues": "https://github.com/sebastianbergmann/comparator/issues",
|
||||||
"source": "https://github.com/sebastianbergmann/comparator/tree/5.0.0"
|
"security": "https://github.com/sebastianbergmann/comparator/security/policy",
|
||||||
|
"source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -4019,7 +4020,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-02-03T07:07:16+00:00"
|
"time": "2023-08-14T13:18:12+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/complexity",
|
"name": "sebastian/complexity",
|
||||||
|
@ -30,7 +30,6 @@ class App
|
|||||||
*/
|
*/
|
||||||
public function __construct(string $configFile)
|
public function __construct(string $configFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Define your configuration schema
|
// Define your configuration schema
|
||||||
$this->config = new Configuration([
|
$this->config = new Configuration([
|
||||||
'rclone' => Expect::structure([
|
'rclone' => Expect::structure([
|
||||||
|
@ -6,6 +6,10 @@ namespace App\Notification;
|
|||||||
|
|
||||||
interface NotificationInterface
|
interface NotificationInterface
|
||||||
{
|
{
|
||||||
static function factory(array $config): self;
|
/**
|
||||||
|
* @param string[] $config Configuration
|
||||||
|
*/
|
||||||
|
public static function factory(array $config): self;
|
||||||
|
|
||||||
public function send(string $title, string $message): void;
|
public function send(string $title, string $message): void;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ use InvalidArgumentException;
|
|||||||
|
|
||||||
class Ntfy implements NotificationInterface
|
class Ntfy implements NotificationInterface
|
||||||
{
|
{
|
||||||
private Client $client;
|
|
||||||
private string $topic = 'default';
|
private string $topic = 'default';
|
||||||
/**
|
/**
|
||||||
* Initialize with configuration.
|
* Initialize with configuration.
|
||||||
@ -28,9 +27,8 @@ class Ntfy implements NotificationInterface
|
|||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct(Client $client)
|
public function __construct(private Client $client)
|
||||||
{
|
{
|
||||||
$this->client = $client;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setTopic(string $topic): void
|
public function setTopic(string $topic): void
|
||||||
|
@ -18,13 +18,6 @@ use Exception;
|
|||||||
*/
|
*/
|
||||||
class Rclone
|
class Rclone
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The logger instance.
|
|
||||||
*/
|
|
||||||
protected LoggerInterface $logger;
|
|
||||||
|
|
||||||
protected string $rclonePath;
|
|
||||||
|
|
||||||
protected string $version = "";
|
protected string $version = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,10 +28,9 @@ class Rclone
|
|||||||
*
|
*
|
||||||
* @param string $rclonePath Relative or absolute path
|
* @param string $rclonePath Relative or absolute path
|
||||||
*/
|
*/
|
||||||
public function __construct(LoggerInterface $logger, string $rclonePath = "rclone")
|
public function __construct(protected LoggerInterface $logger, protected string $rclonePath = "rclone")
|
||||||
{
|
{
|
||||||
$this->rclonePath = $rclonePath;
|
$this->rclonePath = $rclonePath;
|
||||||
$this->logger = $logger;
|
|
||||||
|
|
||||||
$process = $this->exec('--version');
|
$process = $this->exec('--version');
|
||||||
if (!$process->isSuccessful()) {
|
if (!$process->isSuccessful()) {
|
||||||
|
@ -40,6 +40,20 @@ final class CommandBackupTest extends \PHPUnit\Framework\TestCase
|
|||||||
$this->assertStringContainsString('[ERROR] Configuration error:File "bad_file" does not exist.', $output);
|
$this->assertStringContainsString('[ERROR] Configuration error:File "bad_file" does not exist.', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNoCommand(): void
|
||||||
|
{
|
||||||
|
$applicationd = new Application('backup', "1.1.1");
|
||||||
|
|
||||||
|
$applicationd->add(new CommandBackup());
|
||||||
|
|
||||||
|
|
||||||
|
$command = $applicationd->find('backup');
|
||||||
|
$commandTester = new CommandTester($command);
|
||||||
|
$this->expectException(\Exception::class);
|
||||||
|
$commandTester->execute([]);
|
||||||
|
$this->fail('Exception was not thrown');
|
||||||
|
}
|
||||||
|
|
||||||
public function testGoodConfig(): void
|
public function testGoodConfig(): void
|
||||||
{
|
{
|
||||||
$applicationd = new Application('backup', "1.1.1");
|
$applicationd = new Application('backup', "1.1.1");
|
||||||
|
Reference in New Issue
Block a user