diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-09-07 16:09:22 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-10-05 11:00:16 +0200 |
commit | 6807cb684f64587f1747b5168eb42e5172c889eb (patch) | |
tree | 8cd20e87f28693c1c4d2dc44ea9c6c43f597ceeb /tests | |
parent | ac38a3a654df909d2c0c9d7c4d84e8e5ea2c587a (diff) | |
download | nextcloud-server-6807cb684f64587f1747b5168eb42e5172c889eb.tar.gz nextcloud-server-6807cb684f64587f1747b5168eb42e5172c889eb.zip |
avatar to appdata
* Fix AvatarTest
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/AvatarTest.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/lib/AvatarTest.php b/tests/lib/AvatarTest.php index 7f012c895fd..cea3f9bed1a 100644 --- a/tests/lib/AvatarTest.php +++ b/tests/lib/AvatarTest.php @@ -8,6 +8,8 @@ namespace Test; +use OC\Files\SimpleFS\SimpleFolder; +use OC\User\User; use OCP\Files\File; use OCP\Files\Folder; use OCP\IConfig; @@ -30,11 +32,11 @@ class AvatarTest extends \Test\TestCase { public function setUp() { parent::setUp(); - $this->folder = $this->createMock(Folder::class); + $this->folder = $this->createMock(SimpleFolder::class); /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject $l */ $l = $this->createMock(IL10N::class); $l->method('t')->will($this->returnArgument(0)); - $this->user = $this->getMockBuilder('OC\User\User')->disableOriginalConstructor()->getMock(); + $this->user = $this->createMock(User::class); $this->config = $this->createMock(IConfig::class); $this->avatar = new \OC\Avatar( @@ -51,7 +53,7 @@ class AvatarTest extends \Test\TestCase { } public function testGetAvatarSizeMatch() { - $this->folder->method('nodeExists') + $this->folder->method('fileExists') ->will($this->returnValueMap([ ['avatar.jpg', true], ['avatar.128.jpg', true], @@ -61,13 +63,13 @@ class AvatarTest extends \Test\TestCase { $file = $this->createMock(File::class); $file->method('getContent')->willReturn($expected->data()); - $this->folder->method('get')->with('avatar.128.jpg')->willReturn($file); + $this->folder->method('getFile')->with('avatar.128.jpg')->willReturn($file); $this->assertEquals($expected->data(), $this->avatar->get(128)->data()); } public function testGetAvatarSizeMinusOne() { - $this->folder->method('nodeExists') + $this->folder->method('fileExists') ->will($this->returnValueMap([ ['avatar.jpg', true], ])); @@ -76,13 +78,13 @@ class AvatarTest extends \Test\TestCase { $file = $this->createMock(File::class); $file->method('getContent')->willReturn($expected->data()); - $this->folder->method('get')->with('avatar.jpg')->willReturn($file); + $this->folder->method('getFile')->with('avatar.jpg')->willReturn($file); $this->assertEquals($expected->data(), $this->avatar->get(-1)->data()); } public function testGetAvatarNoSizeMatch() { - $this->folder->method('nodeExists') + $this->folder->method('fileExists') ->will($this->returnValueMap([ ['avatar.png', true], ['avatar.32.png', false], @@ -95,7 +97,7 @@ class AvatarTest extends \Test\TestCase { $file = $this->createMock(File::class); $file->method('getContent')->willReturn($expected->data()); - $this->folder->method('get') + $this->folder->method('getFile') ->will($this->returnCallback( function($path) use ($file) { if ($path === 'avatar.png') { @@ -126,7 +128,7 @@ class AvatarTest extends \Test\TestCase { } public function testExiststJPG() { - $this->folder->method('nodeExists') + $this->folder->method('fileExists') ->will($this->returnValueMap([ ['avatar.jpg', true], ['avatar.png', false], @@ -135,7 +137,7 @@ class AvatarTest extends \Test\TestCase { } public function testExistsPNG() { - $this->folder->method('nodeExists') + $this->folder->method('fileExists') ->will($this->returnValueMap([ ['avatar.jpg', false], ['avatar.png', true], |