aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Avatar/UserAvatarTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Avatar/UserAvatarTest.php')
-rw-r--r--tests/lib/Avatar/UserAvatarTest.php27
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php
index cf0edad9502..6e13c993e60 100644
--- a/tests/lib/Avatar/UserAvatarTest.php
+++ b/tests/lib/Avatar/UserAvatarTest.php
@@ -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');