nextcloud/tests/lib/Preview/MovePreviewJobTest.php
Carl Schwan b0357663b9 perf(preview): Optimize migration and simplify DB layout
* Simplify migration by not moving the actual files and just updating
  the DB
* Don't store the storageid in the preview table as it is not needed
* Start adding tests

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-10-06 13:37:15 +02:00

32 lines
856 B
PHP

<?php
namespace lib\Preview;
use OC\Core\BackgroundJobs\MovePreviewJob;
use OCP\Files\AppData\IAppDataFactory;
use OCP\Files\IAppData;
use OCP\Server;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\TestDox;
use Test\TestCase;
/**
* @group DB
*/
#[CoversClass(MovePreviewJob::class)]
class MovePreviewJobTest extends TestCase {
private IAppData $previewAppData;
public function setUp(): void {
parent::setUp();
$this->previewAppData = Server::get(IAppDataFactory::class)->get('preview');
}
#[TestDox("Test the migration from the legacy flat hierarchy to the new one")]
function testMigrationLegacyPath(): void {
$folder = $this->previewAppData->newFolder(5);
$file = $folder->newFile('64-64-crop.png', 'abcdefg');
$job = Server::get(MovePreviewJob::class);
$this->invokePrivate($job, 'run', []);
}
}