Avatar fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
9317e0f0f0
commit
c084008df2
|
@ -52,6 +52,10 @@ class UserAvatarTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetNoAvatar() {
|
||||
if (PHP_MAJOR_VERSION > 7) {
|
||||
$this->markTestSkipped('Only run on php7');
|
||||
}
|
||||
|
||||
$file = $this->createMock(ISimpleFile::class);
|
||||
$this->folder->method('newFile')
|
||||
->willReturn($file);
|
||||
|
@ -78,12 +82,19 @@ class UserAvatarTest extends \Test\TestCase {
|
|||
}));
|
||||
|
||||
$file->method('getContent')
|
||||
->willReturn($data);
|
||||
->willReturnCallback(function() use (&$data) {
|
||||
return $data;
|
||||
});
|
||||
|
||||
$this->assertEquals($data, $this->avatar->get()->data());
|
||||
$result = $this->avatar->get();
|
||||
$this->assertTrue($result->valid());
|
||||
}
|
||||
|
||||
public function testGetAvatarSizeMatch() {
|
||||
if (PHP_MAJOR_VERSION > 7) {
|
||||
$this->markTestSkipped('Only run on php7');
|
||||
}
|
||||
|
||||
$this->folder->method('fileExists')
|
||||
->willReturnMap([
|
||||
['avatar.jpg', true],
|
||||
|
@ -101,6 +112,10 @@ class UserAvatarTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetAvatarSizeMinusOne() {
|
||||
if (PHP_MAJOR_VERSION > 7) {
|
||||
$this->markTestSkipped('Only run on php7');
|
||||
}
|
||||
|
||||
$this->folder->method('fileExists')
|
||||
->willReturnMap([
|
||||
['avatar.jpg', true],
|
||||
|
@ -117,6 +132,10 @@ class UserAvatarTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetAvatarNoSizeMatch() {
|
||||
if (PHP_MAJOR_VERSION > 7) {
|
||||
$this->markTestSkipped('Only run on php7');
|
||||
}
|
||||
|
||||
$this->folder->method('fileExists')
|
||||
->willReturnMap([
|
||||
['avatar.png', true],
|
||||
|
@ -181,6 +200,10 @@ class UserAvatarTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testSetAvatar() {
|
||||
if (PHP_MAJOR_VERSION > 7) {
|
||||
$this->markTestSkipped('Only run on php7');
|
||||
}
|
||||
|
||||
$avatarFileJPG = $this->createMock(File::class);
|
||||
$avatarFileJPG->method('getName')
|
||||
->willReturn('avatar.jpg');
|
||||
|
|
Loading…
Reference in New Issue