findBinaryPath('ffmpeg'); if (is_string($movieBinary)) { parent::setUp(); $this->imgPath = $this->prepareTestFile($this->fileName, \OC::$SERVERROOT . '/tests/data/' . $this->fileName); $this->provider = new Movie(['movieBinary' => $movieBinary]); } else { $this->markTestSkipped('No Movie provider present'); } } #[\PHPUnit\Framework\Attributes\DataProvider('dimensionsDataProvider')] public function testGetThumbnail($widthAdjustment, $heightAdjustment): void { $ratio = round($this->width / $this->height, 2); $this->maxWidth = $this->width - $widthAdjustment; $this->maxHeight = $this->height - $heightAdjustment; $file = new File(Server::get(IRootFolder::class), $this->rootView, $this->imgPath); // Create mock remote file to be passed $remoteStorage = $this->createMock(Storage::class); $remoteStorage->method('isLocal') ->willReturn(false); $mockRemoteVideo = $this->createMock(File::class); $mockRemoteVideo->method('getStorage') ->willReturn($remoteStorage); $mockRemoteVideo->method('getSize') ->willReturn($file->getSize()); $mockRemoteVideo->method('fopen') ->with('r') ->willreturn($file->fopen('r')); $remotePreview = $this->provider->getThumbnail($mockRemoteVideo, $this->maxWidth, $this->maxHeight, $this->scalingUp); $localPreview = $this->provider->getThumbnail($file, $this->maxWidth, $this->maxHeight, $this->scalingUp); $this->assertNotFalse($remotePreview); $this->assertTrue($remotePreview->valid()); $this->assertEquals($remotePreview->data(), $localPreview->data()); } }