|
|
|
|
@ -128,9 +128,9 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
$this->container['AvatarManager']->method('getAvatar')->willReturn($this->avatarMock); |
|
|
|
|
$response = $this->avatarController->getAvatar($this->user, 32); |
|
|
|
|
|
|
|
|
|
//Comment out unitl JS is fixed |
|
|
|
|
//$this->assertEquals($response->getStatus(), Http::STATUS_NOT_FOUND); |
|
|
|
|
$this->assertEquals($response->getData()['data']['displayname'], $this->user); |
|
|
|
|
//Comment out until JS is fixed |
|
|
|
|
//$this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); |
|
|
|
|
$this->assertEquals($this->user, $response->getData()['data']['displayname']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -143,7 +143,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
|
|
|
|
|
$response = $this->avatarController->getAvatar($this->user, 32); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_OK); |
|
|
|
|
$this->assertEquals(Http::STATUS_OK, $response->getStatus()); |
|
|
|
|
|
|
|
|
|
$image2 = new Image($response->getData()); |
|
|
|
|
$this->assertEquals($image->mimeType(), $image2->mimeType()); |
|
|
|
|
@ -160,7 +160,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
|
|
|
|
|
$response = $this->avatarController->getAvatar($this->user . 'doesnotexist', 32); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_OK); |
|
|
|
|
$this->assertEquals(Http::STATUS_OK, $response->getStatus()); |
|
|
|
|
|
|
|
|
|
$image2 = new Image($response->getData()); |
|
|
|
|
$this->assertEquals($image->mimeType(), $image2->mimeType()); |
|
|
|
|
@ -213,7 +213,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
$this->container['AvatarManager']->method('getAvatar')->willReturn($this->avatarMock); |
|
|
|
|
|
|
|
|
|
$response = $this->avatarController->deleteAvatar(); |
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_OK); |
|
|
|
|
$this->assertEquals(Http::STATUS_OK, $response->getStatus()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -224,7 +224,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
$this->container['AvatarManager']->method('getAvatar')->willReturn($this->avatarMock); |
|
|
|
|
|
|
|
|
|
$response = $this->avatarController->deleteAvatar(); |
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_BAD_REQUEST); |
|
|
|
|
$this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -232,7 +232,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
*/ |
|
|
|
|
public function testTmpAvatarNoTmp() { |
|
|
|
|
$response = $this->avatarController->getTmpAvatar(); |
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_NOT_FOUND); |
|
|
|
|
$this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -242,7 +242,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
$this->container['Cache']->method('get')->willReturn(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); |
|
|
|
|
|
|
|
|
|
$response = $this->avatarController->getTmpAvatar(); |
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_OK); |
|
|
|
|
$this->assertEquals(Http::STATUS_OK, $response->getStatus()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -252,7 +252,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
public function testPostAvatarNoPathOrImage() { |
|
|
|
|
$response = $this->avatarController->postAvatar(null); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_BAD_REQUEST); |
|
|
|
|
$this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -275,7 +275,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
$response = $this->avatarController->postAvatar(null); |
|
|
|
|
|
|
|
|
|
//On correct upload always respond with the notsquare message |
|
|
|
|
$this->assertEquals($response->getData()['data'], 'notsquare'); |
|
|
|
|
$this->assertEquals('notsquare', $response->getData()['data']); |
|
|
|
|
|
|
|
|
|
//File should be deleted |
|
|
|
|
$this->assertFalse(file_exists($fileName)); |
|
|
|
|
@ -291,7 +291,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
|
|
|
|
|
$response = $this->avatarController->postAvatar(null); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_BAD_REQUEST); |
|
|
|
|
$this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -313,7 +313,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
|
|
|
|
|
$response = $this->avatarController->postAvatar(null); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($response->getData()['data']['message'], 'Unknown filetype'); |
|
|
|
|
$this->assertEquals('Unknown filetype', $response->getData()['data']['message']); |
|
|
|
|
|
|
|
|
|
//File should be deleted |
|
|
|
|
$this->assertFalse(file_exists($fileName)); |
|
|
|
|
@ -331,7 +331,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
$response = $this->avatarController->postAvatar('avatar.jpg'); |
|
|
|
|
|
|
|
|
|
//On correct upload always respond with the notsquare message |
|
|
|
|
$this->assertEquals($response->getData()['data'], 'notsquare'); |
|
|
|
|
$this->assertEquals('notsquare', $response->getData()['data']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -340,7 +340,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
public function testPostCroppedAvatarInvalidCrop() { |
|
|
|
|
$response = $this->avatarController->postCroppedAvatar([]); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_BAD_REQUEST); |
|
|
|
|
$this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -349,7 +349,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
public function testPostCroppedAvatarNoTmpAvatar() { |
|
|
|
|
$response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 10]); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_BAD_REQUEST); |
|
|
|
|
$this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -362,7 +362,7 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
$this->container['AvatarManager']->method('getAvatar')->willReturn($this->avatarMock); |
|
|
|
|
$response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 11]); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_BAD_REQUEST); |
|
|
|
|
$this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -373,8 +373,8 @@ class AvatarControllerTest extends \Test\TestCase { |
|
|
|
|
$this->container['AvatarManager']->method('getAvatar')->willReturn($this->avatarMock); |
|
|
|
|
$response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 10]); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($response->getStatus(), Http::STATUS_OK); |
|
|
|
|
$this->assertEquals($response->getData()['status'], 'success'); |
|
|
|
|
$this->assertEquals(Http::STATUS_OK, $response->getStatus()); |
|
|
|
|
$this->assertEquals('success', $response->getData()['status']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|