42 lines
975 B
PHP
42 lines
975 B
PHP
|
<?php
|
||
|
|
||
|
namespace Aweos\Resizer\Tests;
|
||
|
|
||
|
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();
|
||
|
|
||
|
$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);
|
||
|
}
|
||
|
}
|