Completed
Push — master ( 28f5b7...87cc9d )
by mw
10:20
created

testClearApprovedFileInfo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.552
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SMW\ApprovedRevs\Tests;
4
5
use SMW\ApprovedRevs\ApprovedRevsFacade;
6
7
/**
8
 * @covers \SMW\ApprovedRevs\ApprovedRevsFacade
9
 * @group semantic-approved-revs
10
 *
11
 * @license GNU GPL v2+
12
 * @since 1.0
13
 *
14
 * @author mwjames
15
 */
16
class ApprovedRevsFacadeTest extends \PHPUnit_Framework_TestCase {
17
18
	public function testCanConstruct() {
19
20
		$this->assertInstanceOf(
21
			ApprovedRevsFacade::class,
22
			new ApprovedRevsFacade()
23
		);
24
	}
25
26
	public function testGetApprovedRevID() {
27
28
		$title = $this->getMockBuilder( '\Title' )
29
			->disableOriginalConstructor()
30
			->getMock();
31
32
		$instance = new ApprovedRevsFacade();
33
34
		$this->assertNull(
35
			$instance->getApprovedRevID( $title )
36
		);
37
	}
38
39
	public function testHasApprovedRevision() {
40
41
		$title = $this->getMockBuilder( '\Title' )
42
			->disableOriginalConstructor()
43
			->getMock();
44
45
		$instance = new ApprovedRevsFacade();
46
47
		$this->assertInternalType(
48
			'boolean',
49
			$instance->hasApprovedRevision( $title )
50
		);
51
	}
52
53
	public function testGetApprovedFileInfo() {
54
55
		$title = $this->getMockBuilder( '\Title' )
56
			->disableOriginalConstructor()
57
			->getMock();
58
59
		$instance = new ApprovedRevsFacade();
60
61
		$this->assertInternalType(
62
			'array',
63
			$instance->getApprovedFileInfo( $title )
64
		);
65
66
	}
67
68
	public function testClearApprovedFileInfo() {
69
70
		$this->assertTrue(
71
			property_exists( new \ApprovedRevs(), 'mApprovedFileInfo' )
72
		);
73
74
		$title = $this->getMockBuilder( '\Title' )
75
			->disableOriginalConstructor()
76
			->getMock();
77
78
		$instance = new ApprovedRevsFacade();
79
80
		$this->assertInternalType(
81
			'array',
82
			$instance->getApprovedFileInfo( $title )
83
		);
84
85
		$title->expects( $this->once() )
86
			->method( 'getDBkey' );
87
88
		$instance = new ApprovedRevsFacade();
89
		$instance->clearApprovedFileInfo( $title );
90
	}
91
92
}
93