mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
* 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>
32 lines
856 B
PHP
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', []);
|
|
}
|
|
}
|