diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-01-23 11:13:47 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-01-23 14:52:21 +0100 |
commit | 039397bd3104d92f7957263520eab0ccfb54f869 (patch) | |
tree | bf87c547f087ba08cea035de5a881c35b2f4c9e3 /tests/settings | |
parent | c61e9f391273e5f7f4b7aa91ee4174d47402cae9 (diff) | |
download | nextcloud-server-039397bd3104d92f7957263520eab0ccfb54f869.tar.gz nextcloud-server-039397bd3104d92f7957263520eab0ccfb54f869.zip |
Use setConfigs() instead of calling setConfig() multiple times
Diffstat (limited to 'tests/settings')
-rw-r--r-- | tests/settings/controller/mailsettingscontrollertest.php | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/tests/settings/controller/mailsettingscontrollertest.php b/tests/settings/controller/mailsettingscontrollertest.php index f6ebade7b17..ed33d7fbe49 100644 --- a/tests/settings/controller/mailsettingscontrollertest.php +++ b/tests/settings/controller/mailsettingscontrollertest.php @@ -69,26 +69,37 @@ class MailSettingsControllerTest extends \Test\TestCase { ); */ - $this->container['Config'] - ->expects($this->exactly(15)) - ->method('setSystemValue'); - + /** @var \PHPUnit_Framework_MockObject_MockObject $config */ + $config = $this->container['Config']; + $config->expects($this->exactly(2)) + ->method('setSystemValues'); /** * FIXME: Use the following block once Jenkins uses PHPUnit >= 4.1 - */ - /* - $this->container['Config'] - ->expects($this->exactly(3)) - ->method('deleteSystemValue') ->withConsecutive( - array($this->equalTo('mail_smtpauth')), - array($this->equalTo('mail_smtpname')), - array($this->equalTo('mail_smtppassword')) + [[ + 'mail_domain' => 'owncloud.com', + 'mail_from_address' => 'demo@owncloud.com', + 'mail_smtpmode' => 'smtp', + 'mail_smtpsecure' => 'ssl', + 'mail_smtphost' => 'mx.owncloud.org', + 'mail_smtpauthtype' => 'NTLM', + 'mail_smtpauth' => 1, + 'mail_smtpport' => '25', + ]], + [[ + 'mail_domain' => 'owncloud.com', + 'mail_from_address' => 'demo@owncloud.com', + 'mail_smtpmode' => 'smtp', + 'mail_smtpsecure' => 'ssl', + 'mail_smtphost' => 'mx.owncloud.org', + 'mail_smtpauthtype' => 'NTLM', + 'mail_smtpauth' => null, + 'mail_smtpport' => '25', + 'mail_smtpname' => null, + 'mail_smtppassword' => null, + ]] ); - */ - $this->container['Config'] - ->expects($this->exactly(3)) - ->method('deleteSystemValue'); + */ // With authentication $response = $this->container['MailSettingsController']->setMailSettings( @@ -126,21 +137,13 @@ class MailSettingsControllerTest extends \Test\TestCase { ->method('t') ->will($this->returnValue('Saved')); - /** - * FIXME: Use this block once Jenkins uses PHPUnit >= 4.1 - */ - /* $this->container['Config'] - ->expects($this->exactly(2)) - ->method('setSystemValue') - ->withConsecutive( - array($this->equalTo('mail_smtpname'), $this->equalTo('UsernameToStore')), - array($this->equalTo('mail_smtppassword'), $this->equalTo('PasswordToStore')) - ); - */ - $this->container['Config'] - ->expects($this->exactly(2)) - ->method('setSystemValue'); + ->expects($this->once()) + ->method('setSystemValues') + ->with([ + 'mail_smtpname' => 'UsernameToStore', + 'mail_smtppassword' => 'PasswordToStore', + ]); $response = $this->container['MailSettingsController']->storeCredentials('UsernameToStore', 'PasswordToStore'); $expectedResponse = array('data' => array('message' =>'Saved'), 'status' => 'success'); |