Skip to content
Snippets Groups Projects
Select Git revision
  • fe7d9a7ca07bb21905c6483dee49bf37dd131674
  • master default protected
2 results

subadminmiddlewaretest.php

Blame
  • mailsettingscontrollertest.php 6.68 KiB
    <?php
    /**
     * @author Lukas Reschke
     * @copyright 2014 Lukas Reschke lukas@owncloud.com
     *
     * This file is licensed under the Affero General Public License version 3 or
     * later.
     * See the COPYING-README file.
     */
    namespace OC\Settings\Controller;
    
    use \OC\Settings\Application;
    
    /**
     * @package OC\Settings\Controller
     */
    class MailSettingscontrollerTest extends \PHPUnit_Framework_TestCase {
    
    	private $container;
    
    	protected function setUp() {
    		$app = new Application();
    		$this->container = $app->getContainer();
    		$this->container['Config'] = $this->getMockBuilder('\OCP\IConfig')
    			->disableOriginalConstructor()->getMock();
    		$this->container['L10N'] = $this->getMockBuilder('\OCP\IL10N')
    			->disableOriginalConstructor()->getMock();
    		$this->container['AppName'] = 'settings';
    		$this->container['UserSession'] = $this->getMockBuilder('\OC\User\Session')
    			->disableOriginalConstructor()->getMock();
    		$this->container['Mail'] = $this->getMockBuilder('\OC_Mail')
    			->disableOriginalConstructor()->getMock();
    		$this->container['Defaults'] = $this->getMockBuilder('\OC_Defaults')
    			->disableOriginalConstructor()->getMock();
    		$this->container['DefaultMailAddress'] = 'no-reply@owncloud.com';
    	}
    
    	public function testSetMailSettings() {
    		$this->container['L10N']
    			->expects($this->exactly(2))
    			->method('t')
    			->will($this->returnValue('Saved'));
    
    		/**
    		 * FIXME: Use the following block once Jenkins uses PHPUnit >= 4.1
    		 */
    		/*
    		$this->container['Config']
    			->expects($this->exactly(15))
    			->method('setSystemValue')
    			->withConsecutive(
    				array($this->equalTo('mail_domain'), $this->equalTo('owncloud.com')),
    				array($this->equalTo('mail_from_address'), $this->equalTo('demo@owncloud.com')),
    				array($this->equalTo('mail_smtpmode'), $this->equalTo('smtp')),
    				array($this->equalTo('mail_smtpsecure'), $this->equalTo('ssl')),
    				array($this->equalTo('mail_smtphost'), $this->equalTo('mx.owncloud.org')),
    				array($this->equalTo('mail_smtpauthtype'), $this->equalTo('NTLM')),
    				array($this->equalTo('mail_smtpauth'), $this->equalTo(1)),
    				array($this->equalTo('mail_smtpport'), $this->equalTo('25')),
    				array($this->equalTo('mail_domain'), $this->equalTo('owncloud.com')),
    				array($this->equalTo('mail_from_address'), $this->equalTo('demo@owncloud.com')),
    				array($this->equalTo('mail_smtpmode'), $this->equalTo('smtp')),
    				array($this->equalTo('mail_smtpsecure'), $this->equalTo('ssl')),
    				array($this->equalTo('mail_smtphost'), $this->equalTo('mx.owncloud.org')),
    				array($this->equalTo('mail_smtpauthtype'), $this->equalTo('NTLM')),
    				array($this->equalTo('mail_smtpport'), $this->equalTo('25'))
    			);
    		 */
    
    		$this->container['Config']