Passed
Pull Request — master (#21)
by GIT
08:43 queued 44s
created

ApprovedRevsFacadeTest::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->assertIsBool(
48
			$instance->hasApprovedRevision( $title )
49
		);
50
	}
51
52
	public function testGetApprovedFileInfo() {
53
54
		$title = $this->getMockBuilder( '\Title' )
55
			->disableOriginalConstructor()
56
			->getMock();
57
58
		$instance = new ApprovedRevsFacade();
59
60
		$this->assertIsArray(
61
			$instance->getApprovedFileInfo( $title )
62
		);
63
64
	}
65
66
	public function testClearApprovedFileInfo() {
67
68
		$this->assertTrue(
69
			property_exists( new \ApprovedRevs(), 'mApprovedFileInfo' )
70
		);
71
72
		$title = $this->getMockBuilder( '\Title' )
73
			->disableOriginalConstructor()
74
			->getMock();
75
76
		$instance = new ApprovedRevsFacade();
77
78
		$this->assertIsArray(
79
			$instance->getApprovedFileInfo( $title )
80
		);
81
82
		$title->expects( $this->once() )
83
			->method( 'getDBkey' );
84
85
		$instance = new ApprovedRevsFacade();
86
		$instance->clearApprovedFileInfo( $title );
87
	}
88
89
}
90