Skip to content

Commit 37d619c

Browse files
susnuxnickvergessen
authored andcommitted
chore: adjust for old PHP
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent afbf291 commit 37d619c

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

tests/lib/Preview/Provider.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
namespace Test\Preview;
2323

2424
use OC\Files\Node\File;
25+
use OC\Preview\Provider as PreviewProvider;
26+
use OCP\Files\IRootFolder;
27+
use OCP\Preview\IProviderV2;
2528

2629
abstract class Provider extends \Test\TestCase {
2730

@@ -31,7 +34,7 @@ abstract class Provider extends \Test\TestCase {
3134
protected $width;
3235
/** @var int */
3336
protected $height;
34-
/** @var \OC\Preview\Provider */
37+
/** @var IProviderV2|PreviewProvider */
3538
protected $provider;
3639
/** @var int */
3740
protected $maxWidth = 1024;
@@ -138,8 +141,10 @@ protected function prepareTestFile($fileName, $fileContent) {
138141
* @return bool|\OCP\IImage
139142
*/
140143
private function getPreview($provider) {
141-
$file = new File(\OC::$server->getRootFolder(), $this->rootView, $this->imgPath);
142-
$preview = $provider->getThumbnail($file, $this->maxWidth, $this->maxHeight, $this->scalingUp);
144+
$file = new File(\OC::$server->get(IRootFolder::class), $this->rootView, $this->imgPath);
145+
$preview = ($provider instanceof PreviewProvider)
146+
? $provider->getThumbnail($file, $this->maxWidth, $this->maxHeight, $this->scalingUp, $this->rootView)
147+
: $provider->getThumbnail($file, $this->maxWidth, $this->maxHeight, $this->scalingUp);
143148

144149
if (get_class($this) === BitmapTest::class && $preview === null) {
145150
$this->markTestSkipped('An error occured while operating with Imagick.');

tests/lib/Preview/SVGTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
namespace Test\Preview;
2323

24+
use OCP\Files\File;
25+
2426
/**
2527
* Class SVGTest
2628
*
@@ -66,7 +68,7 @@ public function testGetThumbnailSVGHref(string $content): void {
6668
</svg>');
6769
rewind($handle);
6870

69-
$file = $this->createMock(\OCP\Files\File::class);
71+
$file = $this->createMock(File::class);
7072
$file->method('fopen')
7173
->willReturn($handle);
7274

0 commit comments

Comments
 (0)