/** * 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']); }
/** * Test posting avatar from existing file */ public function testPostAvatarFromFile() { //Create file in cache $view = new \OC\Files\View('/' . $this->user . '/files'); $view->file_put_contents('avatar.jpg', file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg')); //Create request return $response = $this->avatarController->postAvatar('avatar.jpg'); //On correct upload always respond with the notsquare message $this->assertEquals('notsquare', $response->getData()['data']); }