X Tutup
Skip to content

Commit baa42d6

Browse files
committed
Adding AvatarNodeTest
1 parent 0d750e8 commit baa42d6

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

apps/dav/lib/Avatars/AvatarNode.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
namespace OCA\DAV\Avatars;
2424

2525

26-
use OCA\DAV\IPublicNode;
2726
use OCP\IAvatar;
2827
use Sabre\DAV\File;
2928

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* @author Thomas Müller <thomas.mueller@tmit.eu>
4+
*
5+
* @copyright Copyright (c) 2017, ownCloud GmbH
6+
* @license AGPL-3.0
7+
*
8+
* This code is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License, version 3,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License, version 3,
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>
19+
*
20+
*/
21+
22+
23+
namespace OCA\DAV\Tests\Unit\Avatars;
24+
25+
26+
use OCA\DAV\Avatars\AvatarNode;
27+
use OCP\IAvatar;
28+
use Test\TestCase;
29+
30+
class AvatarNodeTest extends TestCase {
31+
32+
public function testGetName() {
33+
/** @var IAvatar | \PHPUnit_Framework_MockObject_MockObject $a */
34+
$a = $this->createMock(IAvatar::class);
35+
$n = new AvatarNode(1024, 'png', $a);
36+
$this->assertEquals('1024.png', $n->getName());
37+
}
38+
39+
public function testGetContentType() {
40+
/** @var IAvatar | \PHPUnit_Framework_MockObject_MockObject $a */
41+
$a = $this->createMock(IAvatar::class);
42+
$n = new AvatarNode(1024, 'png', $a);
43+
$this->assertEquals('image/png', $n->getContentType());
44+
45+
$n = new AvatarNode(1024, 'jpeg', $a);
46+
$this->assertEquals('image/jpeg', $n->getContentType());
47+
}
48+
}

0 commit comments

Comments
 (0)
X Tutup