/**
	 * Check for proper reply on proper crop argument
	 */
	public function testPostCroppedAvatarValidCrop() {
		$this->container['Cache']->method('get')->willReturn(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
		$this->container['AvatarManager']->method('getAvatar')->willReturn($this->avatarMock);
		$response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 10]);

		$this->assertEquals(Http::STATUS_OK, $response->getStatus());
		$this->assertEquals('success', $response->getData()['status']);
	}
Example #2
0
 /**
  * Check for proper reply on proper crop argument
  */
 public function testFileTooBig()
 {
     $fileName = OC::$SERVERROOT . '/tests/data/testimage.jpg';
     //Create request return
     $reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [21 * 1024 * 1024]];
     $this->container['Request']->method('getUploadedFile')->willReturn($reqRet);
     $response = $this->avatarController->postAvatar(null);
     $this->assertEquals('File is too big', $response->getData()['data']['message']);
 }