Completed
Pull Request — master (#1202)
by Christoph
06:41
created

CreateAccountTest::testDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
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
use PHPUnit_Framework_TestCase;
13
use OCA\Mail\Command\CreateAccount;
14
15
class CreateAccountTest extends PHPUnit_Framework_TestCase {
16
17
	private $service;
18
	private $crypto;
19
	private $command;
20
	private $args = [
21
		'user-id',
22
		'name',
23
		'email',
24
		'imap-host',
25
		'imap-port',
26
		'imap-ssl-mode',
27
		'imap-user',
28
		'imap-password',
29
		'smtp-host',
30
		'smtp-port',
31
		'smtp-ssl-mode',
32
		'smtp-user',
33
		'smtp-password',
34
	];
35
36
	protected function setUp() {
37
		parent::setUp();
38
39
		$this->service = $this->getMockBuilder('\OCA\Mail\Service\AccountService')
40
			->disableOriginalConstructor()
41
			->getMock();
42
		$this->crypto = $this->getMock('\OCP\Security\ICrypto');
43
44
		$this->command = new CreateAccount($this->service, $this->crypto);
45
	}
46
47
	public function testName() {
48
		$this->assertSame('mail:account:create', $this->command->getName());
49
	}
50
51
	public function testDescription() {
52
		$this->assertSame('creates IMAP account', $this->command->getDescription());
53
	}
54
55
	public function testArguments() {
56
		$actual = $this->command->getDefinition()->getArguments();
57
58
		foreach ($actual as $actArg) {
59
			$this->assertTrue($actArg->isRequired());
60
			$this->assertTrue(in_array($actArg->getName(), $this->args));
61
		}
62
	}
63
64
}
65