Completed
Pull Request — master (#1638)
by Thomas
06:26
created

CreateAccountTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 50
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @author Christoph Wurst <[email protected]>
5
 *
6
 * Mail
7
 *
8
 * This code is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License, version 3,
10
 * as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License, version 3,
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
19
 *
20
 */
21
22
namespace OCA\Mail\Tests\Command;
23
24
use PHPUnit_Framework_TestCase;
25
use OCA\Mail\Command\CreateAccount;
26
27
class CreateAccountTest extends PHPUnit_Framework_TestCase {
28
29
	private $service;
30
	private $crypto;
31
	private $command;
32
	private $args = [
33
		'user-id',
34
		'name',
35
		'email',
36
		'imap-host',
37
		'imap-port',
38
		'imap-ssl-mode',
39
		'imap-user',
40
		'imap-password',
41
		'smtp-host',
42
		'smtp-port',
43
		'smtp-ssl-mode',
44
		'smtp-user',
45
		'smtp-password',
46
	];
47
48
	protected function setUp() {
49
		parent::setUp();
50
51
		$this->service = $this->getMockBuilder('\OCA\Mail\Service\AccountService')
52
			->disableOriginalConstructor()
53
			->getMock();
54
		$this->crypto = $this->getMock('\OCP\Security\ICrypto');
55
56
		$this->command = new CreateAccount($this->service, $this->crypto);
57
	}
58
59
	public function testName() {
60
		$this->assertSame('mail:account:create', $this->command->getName());
61
	}
62
63
	public function testDescription() {
64
		$this->assertSame('creates IMAP account', $this->command->getDescription());
65
	}
66
67
	public function testArguments() {
68
		$actual = $this->command->getDefinition()->getArguments();
69
70
		foreach ($actual as $actArg) {
71
			$this->assertTrue($actArg->isRequired());
72
			$this->assertTrue(in_array($actArg->getName(), $this->args));
73
		}
74
	}
75
76
}
77