1 | <?php |
||
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 |