summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests/lib/MigratorTest.php
blob: a9d57b342094b30cc530e8a9a54312d9e7e2cc24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
 * @author Clark Tomlinson  <fallen013@gmail.com>
 * @since 3/9/15, 2:56 PM
 * @link http:/www.clarkt.com
 * @copyright Clark Tomlinson © 2015
 *
 */

namespace OCA\Encryption\Tests;


use OCA\Encryption\Migrator;
use Test\TestCase;

class MigratorTest extends TestCase {

	/**
	 * @var Migrator
	 */
	private $instance;

	/**
	 *
	 */
	public function testGetStatus() {
		$this->assertFalse($this->instance->getStatus('admin'));
	}

	/**
	 *
	 */
	public function testBeginMigration() {
		$this->assertTrue($this->instance->beginMigration());
	}

	/**
	 *
	 */
	public function testSetMigrationStatus() {
		$this->assertTrue(\Test_Helper::invokePrivate($this->instance,
			'setMigrationStatus',
			['0', '-1'])
		);
	}

	/**
	 *
	 */
	protected function setUp() {
		parent::setUp();

		$cryptMock = $this->getMockBuilder('OCA\Encryption\Crypto\Crypt')->disableOriginalConstructor()->getMock();
		$this->instance = new Migrator($this->getMock('OCP\IUser'),
			$this->getMock('OCP\IConfig'),
			$this->getMock('OCP\IUserManager'),
			$this->getMock('OCP\ILogger'),
			$cryptMock);
	}


}