diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-06-25 15:05:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-25 15:05:54 +0200 |
commit | d4a44d9b784eef554a0e5450d07bd5d5d2d61193 (patch) | |
tree | 65c3940185836f6635558b62b16e5ee65b94a1a2 /tests/lib | |
parent | 335af0c46c0034ea9052a90fa2b43a0b9bc985e7 (diff) | |
parent | 615061437422499025e038483504d4ef2004c8e1 (diff) | |
download | nextcloud-server-d4a44d9b784eef554a0e5450d07bd5d5d2d61193.tar.gz nextcloud-server-d4a44d9b784eef554a0e5450d07bd5d5d2d61193.zip |
Merge pull request #15870 from nextcloud/preview-provider-v2
Add new Provider interface for preview providers
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Preview/GeneratorTest.php | 7 | ||||
-rw-r--r-- | tests/lib/Preview/Provider.php | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php index 565b526b659..9bca43a1a7e 100644 --- a/tests/lib/Preview/GeneratorTest.php +++ b/tests/lib/Preview/GeneratorTest.php @@ -33,6 +33,7 @@ use OCP\IConfig; use OCP\IImage; use OCP\IPreview; use OCP\Preview\IProvider; +use OCP\Preview\IProviderV2; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; @@ -149,13 +150,13 @@ class GeneratorTest extends \Test\TestCase { return $defult; })); - $invalidProvider = $this->createMock(IProvider::class); + $invalidProvider = $this->createMock(IProviderV2::class); $invalidProvider->method('isAvailable') ->willReturn(true); - $unavailableProvider = $this->createMock(IProvider::class); + $unavailableProvider = $this->createMock(IProviderV2::class); $unavailableProvider->method('isAvailable') ->willReturn(false); - $validProvider = $this->createMock(IProvider::class); + $validProvider = $this->createMock(IProviderV2::class); $validProvider->method('isAvailable') ->with($file) ->willReturn(true); diff --git a/tests/lib/Preview/Provider.php b/tests/lib/Preview/Provider.php index 5377f30df82..2050b3f56b4 100644 --- a/tests/lib/Preview/Provider.php +++ b/tests/lib/Preview/Provider.php @@ -21,6 +21,8 @@ namespace Test\Preview; +use OC\Files\Node\File; + abstract class Provider extends \Test\TestCase { /** @var string */ @@ -136,7 +138,8 @@ abstract class Provider extends \Test\TestCase { * @return bool|\OCP\IImage */ private function getPreview($provider) { - $preview = $provider->getThumbnail($this->imgPath, $this->maxWidth, $this->maxHeight, $this->scalingUp, $this->rootView); + $file = new File(\OC::$server->getRootFolder(), $this->rootView, $this->imgPath); + $preview = $provider->getThumbnail($file, $this->maxWidth, $this->maxHeight, $this->scalingUp); $this->assertNotEquals(false, $preview); $this->assertEquals(true, $preview->valid()); |