Completed
Push — master ( b799b3...a573be )
by Thomas
07:38
created

CreateAccountTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 50
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 1
A testName() 0 3 1
A testDescription() 0 3 1
A testArguments() 0 8 2
1
<?php
2
3
/**
4
 * ownCloud - Mail
5
 *
6
 * This file is licensed under the Affero General Public License version 3 or
7
 * later. See the COPYING file.
8
 *
9
 * @author Christoph Wurst <[email protected]>
10
 * @copyright Christoph Wurst 2016
11
 */
12
13
namespace OCA\Mail\Tests\Command;
14
15
use PHPUnit_Framework_TestCase;
16
use OCA\Mail\Command\CreateAccount;
17
18
class CreateAccountTest extends PHPUnit_Framework_TestCase {
19
20
	private $service;
21
	private $crypto;
22
	private $command;
23
	private $args = [
24
		'user-id',
25
		'name',
26
		'email',
27
		'imap-host',
28
		'imap-port',
29
		'imap-ssl-mode',
30
		'imap-user',
31
		'imap-password',
32
		'smtp-host',
33
		'smtp-port',
34
		'smtp-ssl-mode',
35
		'smtp-user',
36
		'smtp-password',
37
	];
38
39
	protected function setUp() {
40
		parent::setUp();
41
42
		$this->service = $this->getMockBuilder('\OCA\Mail\Service\AccountService')
43
			->disableOriginalConstructor()
44
			->getMock();
45
		$this->crypto = $this->getMock('\OCP\Security\ICrypto');
46
47
		$this->command = new CreateAccount($this->service, $this->crypto);
48
	}
49
50
	public function testName() {
51
		$this->assertSame('mail:account:create', $this->command->getName());
52
	}
53
54
	public function testDescription() {
55
		$this->assertSame('creates IMAP account', $this->command->getDescription());
56
	}
57
58
	public function testArguments() {
59
		$actual = $this->command->getDefinition()->getArguments();
60
61
		foreach ($actual as $actArg) {
62
			$this->assertTrue($actArg->isRequired());
63
			$this->assertTrue(in_array($actArg->getName(), $this->args));
64
		}
65
	}
66
67
}
68