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

CheckpointTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetAll() 0 17 1
A getCheckpointInstance() 0 3 1
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