Completed
Pull Request — master (#217)
by Thomas
03:10
created

CheckpointTest::testGetAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
rs 9.4285
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
3
namespace Owncloud\Updater\Tests\Utils;
4
5
use Owncloud\Updater\Utils\Checkpoint;
6
use Owncloud\Updater\Utils\FilesystemHelper;
7
use Owncloud\Updater\Utils\Locator;
8
9
class CheckpointTest extends \PHPUnit_Framework_TestCase {
10
	public function testGetAll(){
11
		$checkpointList = ['a', 'b', 'c'];
12
		$fsHelper = $this->getMockBuilder('Owncloud\Updater\Utils\FilesystemHelper')
13
				->disableOriginalConstructor()
14
				->getMock()
15
		;
16
		$fsHelper->method('scandir')
17
				->willReturn($checkpointList)
18
		;
19
		$locator = $this->getMockBuilder('Owncloud\Updater\Utils\Locator')
20
				->disableOriginalConstructor()
21
				->getMock()
22
		;
23
		$checkpointMock = $this->getCheckpointInstance($locator, $fsHelper);
24
		$actual = $checkpointMock->getAll();
25
		$this->assertEquals($checkpointList, $actual);
26
	}
27
28
29
30
	protected function getCheckpointInstance(Locator $locator, FilesystemHelper $fsHelper){
31
		return new Checkpoint($locator, $fsHelper);
32
	}
33
}
34