Static analysis of unittest code.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests;
|
||||
|
||||
use App\Rclone\Rclone;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@ -7,15 +11,12 @@ final class RcloneTest extends TestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
if(!is_dir('temp')) {
|
||||
mkdir('temp');
|
||||
}
|
||||
exec('rclone test makefiles temp/source 2>&1');
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
exec('rclone purge temp 2>&1', $output);
|
||||
exec('rclone purge temp 2>&1');
|
||||
}
|
||||
|
||||
|
||||
@ -23,20 +24,20 @@ final class RcloneTest extends TestCase
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$rclone = new Rclone('invalid');
|
||||
$this->assertString('', $rclone->getVersion());
|
||||
$this->assertEquals('', $rclone->getVersion());
|
||||
}
|
||||
|
||||
public function testRcloneInvalidVersion(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$rclone = new Rclone('uname');
|
||||
$this->assertString('', $rclone->getVersion());
|
||||
$this->assertEquals('', $rclone->getVersion());
|
||||
}
|
||||
|
||||
public function testRcloneValidVersion(): void
|
||||
{
|
||||
$rclone = new Rclone();
|
||||
$this->assertStringContainsString('rclone', $rclone->getVersion());
|
||||
$this->assertStringStartsWith('rclone', $rclone->getVersion());
|
||||
}
|
||||
|
||||
public function testRcloneSize(): void
|
||||
@ -54,16 +55,16 @@ final class RcloneTest extends TestCase
|
||||
public function testRcloneCopy(): void
|
||||
{
|
||||
$rclone = new Rclone();
|
||||
$result = $rclone->copy('temp/source','temp/destination');
|
||||
$rclone->copy('temp/source', 'temp/destination');
|
||||
$this->assertDirectoryExists('temp/destination');
|
||||
|
||||
$rclone = new Rclone();
|
||||
$result = $rclone->copy('temp/source','temp/destination',['bwlimit'=>'6M']);
|
||||
$rclone->copy('temp/source', 'temp/destination', ['bwlimit' => '6M']);
|
||||
$this->assertDirectoryExists('temp/destination');
|
||||
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage("ERROR");
|
||||
$result = $rclone->copy('temp/bogus-source','temp/bogus-destination');
|
||||
$rclone->copy('temp/bogus-source', 'temp/bogus-destination');
|
||||
$this->assertDirectoryDoesNotExist('temp/bogus-destination');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user