diff options
Diffstat (limited to 'tests/lib/Preview/MovieTest.php')
-rw-r--r-- | tests/lib/Preview/MovieTest.php | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/tests/lib/Preview/MovieTest.php b/tests/lib/Preview/MovieTest.php index d41b242945b..c85a9f99748 100644 --- a/tests/lib/Preview/MovieTest.php +++ b/tests/lib/Preview/MovieTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -7,6 +8,10 @@ namespace Test\Preview; +use OC\Preview\Movie; +use OCP\IBinaryFinder; +use OCP\Server; + /** * Class MovieTest * @@ -15,21 +20,22 @@ namespace Test\Preview; * @package Test\Preview */ class MovieTest extends Provider { + protected string $fileName = 'testimage.mp4'; + protected int $width = 560; + protected int $height = 320; + protected function setUp(): void { - $avconvBinary = \OC_Helper::findBinaryPath('avconv'); - $ffmpegBinary = ($avconvBinary) ? null : \OC_Helper::findBinaryPath('ffmpeg'); + $binaryFinder = Server::get(IBinaryFinder::class); + $movieBinary = $binaryFinder->findBinaryPath('avconv'); + if (!is_string($movieBinary)) { + $movieBinary = $binaryFinder->findBinaryPath('ffmpeg'); + } - if ($avconvBinary || $ffmpegBinary) { + if (is_string($movieBinary)) { parent::setUp(); - \OC\Preview\Movie::$avconvBinary = $avconvBinary; - \OC\Preview\Movie::$ffmpegBinary = $ffmpegBinary; - - $fileName = 'testimage.mp4'; - $this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName); - $this->width = 560; - $this->height = 320; - $this->provider = new \OC\Preview\Movie; + $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'); } |