mirror of
https://github.com/Chouchen/Shikiryu_Backup.git
synced 2026-09-24 16:03:54 +02:00
✅ Add first tests
This commit is contained in:
1 parent
0952cf2db3
commit
02ad4f286e
14 files changed
+1958
-58
No files matched your search
@@ -0,0 +1,43 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shikiryu\Backup\Backup\Files;
|
||||
use Shikiryu\Exceptions\BackupException;
|
||||
|
||||
class FilesTest extends TestCase
|
||||
{
|
||||
public function testIsValid()
|
||||
{
|
||||
$files = [
|
||||
__DIR__ . '/file1',
|
||||
__DIR__ . '/file2',
|
||||
];
|
||||
foreach ($files as $file) {
|
||||
touch($file);
|
||||
}
|
||||
$file = new Files([
|
||||
'files' => $files
|
||||
]);
|
||||
$this->assertTrue($file->isValid());
|
||||
foreach ($files as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
public function testIsNotValid()
|
||||
{
|
||||
$file = new Files([
|
||||
'files' => [
|
||||
'/file1',
|
||||
'/file2',
|
||||
],
|
||||
]);
|
||||
$this->assertFalse($file->isValid());
|
||||
}
|
||||
|
||||
public function testInvalidConstruct()
|
||||
{
|
||||
$this->expectException(BackupException::class);
|
||||
$file = new Files([]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user