public function testGetHtmlBody() { $accountId = 17; $folderId = 'testfolder'; $messageId = 4321; $this->accountService->expects($this->once())->method('find')->with($this->equalTo($this->userId), $this->equalTo($accountId))->will($this->returnValue($this->account)); $this->account->expects($this->once())->method('getMailbox')->with($this->equalTo($folderId))->will($this->returnValue($this->mailbox)); $this->mailbox->expects($this->once())->method('getMessage')->with($this->equalTo($messageId), $this->equalTo(true))->will($this->returnValue($this->message)); $expectedResponse = new \OCA\Mail\Http\HtmlResponse(null); $expectedResponse->cacheFor(3600); $expectedResponse->addHeader('Pragma', 'cache'); if (class_exists('\\OCP\\AppFramework\\Http\\ContentSecurityPolicy')) { $policy = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $policy->allowEvalScript(false); $policy->disallowScriptDomain('\'self\''); $policy->disallowConnectDomain('\'self\''); $policy->disallowFontDomain('\'self\''); $policy->disallowMediaDomain('\'self\''); $expectedResponse->setContentSecurityPolicy($policy); } $actualResponse = $this->controller->getHtmlBody($accountId, base64_encode($folderId), $messageId); $this->assertEquals($expectedResponse, $actualResponse); }