diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-17 11:46:30 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-01-18 13:40:55 +0100 |
commit | 3d4c698f448925aca62976175ffd4bab9694c7d6 (patch) | |
tree | 6ab0f4840ef17e67cc97426cc323b46dc31f80c0 /tests/lib/AvatarTest.php | |
parent | c121610d5a42b8a30a328c0a2f9704fb20d4c369 (diff) | |
download | nextcloud-server-3d4c698f448925aca62976175ffd4bab9694c7d6.tar.gz nextcloud-server-3d4c698f448925aca62976175ffd4bab9694c7d6.zip |
Improve OC_Image code to not guess the type of input, but actually request the specific methods to be called
Followup to #7836
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib/AvatarTest.php')
-rw-r--r-- | tests/lib/AvatarTest.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/lib/AvatarTest.php b/tests/lib/AvatarTest.php index 9da719c26de..4914c02bd14 100644 --- a/tests/lib/AvatarTest.php +++ b/tests/lib/AvatarTest.php @@ -89,7 +89,8 @@ class AvatarTest extends \Test\TestCase { ['avatar.128.jpg', true], ])); - $expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $expected = new \OC_Image(); + $expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png'); $file = $this->createMock(File::class); $file->method('getContent')->willReturn($expected->data()); @@ -104,7 +105,8 @@ class AvatarTest extends \Test\TestCase { ['avatar.jpg', true], ])); - $expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $expected = new \OC_Image(); + $expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png'); $file = $this->createMock(File::class); $file->method('getContent')->willReturn($expected->data()); @@ -120,8 +122,10 @@ class AvatarTest extends \Test\TestCase { ['avatar.32.png', false], ])); - $expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); - $expected2 = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $expected = new \OC_Image(); + $expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $expected2 = new \OC_Image(); + $expected2->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png'); $expected2->resize(32); $file = $this->createMock(File::class); @@ -205,7 +209,8 @@ class AvatarTest extends \Test\TestCase { ->with('avatar.png') ->willReturn($newFile); - $image = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $image = new \OC_Image(); + $image->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png'); $newFile->expects($this->once()) ->method('putContent') ->with($image->data()); |