fix tests

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-02-03 12:28:37 +01:00
parent 84cf39f582
commit fa1ee8f0c7
3 changed files with 30 additions and 1 deletions

View file

@ -172,6 +172,7 @@ class CheckSetupControllerTest extends TestCase {
])
->setMethods([
'isReadOnlyConfig',
'wasEmailTestSuccessful',
'hasValidTransactionIsolationLevel',
'hasFileinfoInstalled',
'hasWorkingFileLocking',
@ -496,6 +497,10 @@ class CheckSetupControllerTest extends TestCase {
->expects($this->once())
->method('isReadOnlyConfig')
->willReturn(false);
$this->checkSetupController
->expects($this->once())
->method('wasEmailTestSuccessful')
->willReturn(false);
$this->checkSetupController
->expects($this->once())
->method('hasValidTransactionIsolationLevel')
@ -594,6 +599,7 @@ class CheckSetupControllerTest extends TestCase {
[
'isGetenvServerWorking' => true,
'isReadOnlyConfig' => false,
'wasEmailTestSuccessful' => false,
'hasValidTransactionIsolationLevel' => true,
'hasFileinfoInstalled' => true,
'hasWorkingFileLocking' => true,

View file

@ -38,6 +38,7 @@ use OCP\IRequest;
use OCP\IUserSession;
use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
use OCP\IURLGenerator;
/**
* @package Tests\Settings\Controller
@ -52,6 +53,8 @@ class MailSettingsControllerTest extends \Test\TestCase {
private $mailer;
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l;
/** @var IURLGenerator */
private $urlGenerator;
/** @var MailSettingsController */
private $mailController;
@ -63,6 +66,7 @@ class MailSettingsControllerTest extends \Test\TestCase {
$this->config = $this->createMock(IConfig::class);
$this->userSession = $this->createMock(IUserSession::class);
$this->mailer = $this->createMock(IMailer::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
/** @var IRequest|\PHPUnit\Framework\MockObject\MockObject $request */
$request = $this->createMock(IRequest::class);
$this->mailController = new MailSettingsController(
@ -71,6 +75,7 @@ class MailSettingsControllerTest extends \Test\TestCase {
$this->l,
$this->config,
$this->userSession,
$this->urlGenerator,
$this->mailer,
'no-reply@nextcloud.com'
);
@ -170,7 +175,7 @@ class MailSettingsControllerTest extends \Test\TestCase {
// Ensure that it fails when no mail address has been specified
$response = $this->mailController->sendTestMail();
$this->assertSame(Http::STATUS_BAD_REQUEST, $response->getStatus());
$this->assertSame('You need to set your user email before being able to send test emails.', $response->getData());
$this->assertSame('You need to set your user email before being able to send test emails. Go to for that.', $response->getData());
// If no exception is thrown it should work
$this->config

View file

@ -226,6 +226,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -283,6 +284,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -341,6 +343,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -396,6 +399,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -450,6 +454,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -504,6 +509,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -560,6 +566,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -614,6 +621,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -668,6 +676,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -742,6 +751,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -797,6 +807,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -852,6 +863,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -907,6 +919,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -965,6 +978,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -1020,6 +1034,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -1072,6 +1087,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -1126,6 +1142,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',
@ -1180,6 +1197,7 @@ describe('OC.SetupChecks tests', function() {
hasFileinfoInstalled: true,
isGetenvServerWorking: true,
isReadOnlyConfig: false,
wasEmailTestSuccessful: true,
hasWorkingFileLocking: true,
hasValidTransactionIsolationLevel: true,
suggestedOverwriteCliURL: '',