|
| 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