aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/avatar.php
blob: 42b06f8bccb553fd6fd1e9db673ca8e47478d5dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
 * Copyright (c) 2013 Christopher Schäpers <christopher@schaepers.it>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

class Test_Avatar extends PHPUnit_Framework_TestCase {

	public function testAvatar() {
		$expected = \OC_Avatar::getDefaultAvatar()->data();
		$this->assertEquals($expected, \OC_Avatar::get(\OC_User::getUser())->data());

		$expected = new OC_Image(\OC::$SERVERROOT.'/tests/data/testavatar.png');
		\OC_Avatar::set(\OC_User::getUser(), $expected->data());
		$expected->resize(64);
		$this->assertEquals($expected->data(), \OC_Avatar::get(\OC_User::getUser())->data());

		\OC_Avatar::set(\OC_User::getUser(), false);
		$expected = \OC_Avatar::getDefaultAvatar()->data();
		$this->assertEquals($expected, \OC_Avatar::get(\OC_User::getUser())->data());
	}

	/*public function testDefaultAvatar() {
		$img = new \OC_Image(OC::$SERVERROOT.'/core/img/defaultavatar.png');
		$img->resize(128);
		$this->assertEquals($img->data(), \OC_Avatar::getDefaultAvatar(\OC_User::getUser(), 128)->data());
	}*/
}