Unittest inclusion
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Jens True 2023-05-31 09:42:39 +00:00
parent 24ad0a5963
commit 6d940c58b2
5 changed files with 1662 additions and 5 deletions

24
.vscode/launch.json vendored Normal file

@ -0,0 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"args": ["backup", "config.example.yml"],
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
}
]
}

@ -2,8 +2,13 @@ pipeline:
requirements: requirements:
image: composer image: composer
commands: commands:
- composer install - composer install --no-dev
deploy: run:
image: php image: php
commands: commands:
- ./backup show config.example.yml - ./backup show config.example.yml
test:
image: composer
commands:
- composer install
- ./vendor/bin/phpunit tests

@ -19,6 +19,7 @@
"squizlabs/php_codesniffer": "*", "squizlabs/php_codesniffer": "*",
"phpstan/phpstan": "^1.10", "phpstan/phpstan": "^1.10",
"vimeo/psalm": "^5.12", "vimeo/psalm": "^5.12",
"phpmd/phpmd": "^2.13" "phpmd/phpmd": "^2.13",
"phpunit/phpunit": "^9.6"
} }
} }

1611
composer.lock generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,18 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class RcloneTest extends TestCase
{
public function testExceptionOnInvalidRclonePath(): void
{
$this->expectException(\Exception::class);
$rclone = new \App\Rclone\Rclone('invalid');
}
public function testRcloneVersion(): void
{
$rclone = new \App\Rclone\Rclone();
$this->assertStringContainsString('rclone', $rclone->getversion());
}
}