summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorblizzz <blizzz@owncloud.com>2013-11-22 03:42:28 -0800
committerblizzz <blizzz@owncloud.com>2013-11-22 03:42:28 -0800
commit2f73db12bb5de852485b550b11c65d3205792cf7 (patch)
treecea96b485e82d75f24796f238f181465d2952d88 /tests
parent60cfdae50399c362edee204cb6849db8203a63b0 (diff)
parent92c8672c0f4cae5881abdb4832955e3fa6ae6350 (diff)
downloadnextcloud-server-2f73db12bb5de852485b550b11c65d3205792cf7.tar.gz
nextcloud-server-2f73db12bb5de852485b550b11c65d3205792cf7.zip
Merge pull request #5040 from owncloud/public_api_avatar_master
Add public API for \OC\Avatar
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/avatar.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/lib/avatar.php b/tests/lib/avatar.php
index 6e6faed2d2c..9cc14865a29 100644
--- a/tests/lib/avatar.php
+++ b/tests/lib/avatar.php
@@ -22,4 +22,19 @@ class Test_Avatar extends PHPUnit_Framework_TestCase {
$avatar->remove();
$this->assertEquals(false, $avatar->get());
}
+
+ public function testAvatarApi() {
+ $avatarManager = \OC::$server->getAvatarManager();
+ $avatar = $avatarManager->getAvatar(\OC_User::getUser());
+
+ $this->assertEquals(false, $avatar->get());
+
+ $expected = new OC_Image(\OC::$SERVERROOT.'/tests/data/testavatar.png');
+ $expected->resize(64);
+ $avatar->set($expected->data());
+ $this->assertEquals($expected->data(), $avatar->get()->data());
+
+ $avatar->remove();
+ $this->assertEquals(false, $avatar->get());
+ }
}