44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Aweos\Resizer\Tests;
|
|
|
|
use Aweos\Resizer\Models\Setting;
|
|
use Media\Classes\MediaLibrary;
|
|
use PluginTestCase;
|
|
use Storage;
|
|
use System\Classes\PluginManager;
|
|
|
|
class TestCase extends PluginTestCase
|
|
{
|
|
|
|
public MediaLibrary $media;
|
|
|
|
public function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
Setting::set('queue', 'default');
|
|
$this->media = MediaLibrary::instance();
|
|
}
|
|
|
|
public function assertHasFile($file): void
|
|
{
|
|
Storage::disk('local')->assertExists("uploads/public/c/{$this->normalizeFilePath($file)}");
|
|
}
|
|
|
|
public function assertDoesntHaveFile($file): void
|
|
{
|
|
Storage::disk('local')->assertMissing("uploads/public/c/{$this->normalizeFilePath($file)}");
|
|
}
|
|
|
|
public function assertFileCount($count, $dir): void
|
|
{
|
|
$this->assertCount($count, Storage::disk('local')->files("uploads/public/c/{$this->normalizeFilePath($dir)}"));
|
|
}
|
|
|
|
public function normalizeFilePath(string $path): string
|
|
{
|
|
return preg_replace('|^/*|', '', $path);
|
|
}
|
|
}
|