2222namespace Test \Preview ;
2323
2424use OC \Files \Node \File ;
25+ use OC \Preview \Provider as PreviewProvider ;
26+ use OCP \Files \IRootFolder ;
27+ use OCP \Preview \IProviderV2 ;
2528
2629abstract 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. ' );
0 commit comments