|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SCI\Tests; |
|
4
|
|
|
|
|
5
|
|
|
use SCI\ReferenceListFactory; |
|
6
|
|
|
use SCI\Options; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* @covers \SCI\ReferenceListFactory |
|
10
|
|
|
* @group semantic-cite |
|
11
|
|
|
* |
|
12
|
|
|
* @license GNU GPL v2+ |
|
13
|
|
|
* @since 1.0 |
|
14
|
|
|
* |
|
15
|
|
|
* @author mwjames |
|
16
|
|
|
*/ |
|
17
|
|
|
class ReferenceListFactoryTest extends \PHPUnit_Framework_TestCase { |
|
18
|
|
|
|
|
19
|
|
|
private $store; |
|
20
|
|
|
private $namespaceExaminer; |
|
21
|
|
|
private $citationReferencePositionJournal; |
|
22
|
|
|
|
|
23
|
|
|
protected function setUp() : void { |
|
24
|
|
|
|
|
25
|
|
|
$this->store = $this->getMockBuilder( '\SMW\Store' ) |
|
26
|
|
|
->disableOriginalConstructor() |
|
27
|
|
|
->getMockForAbstractClass(); |
|
28
|
|
|
|
|
29
|
|
|
$this->namespaceExaminer = $this->getMockBuilder( '\SMW\NamespaceExaminer' ) |
|
30
|
|
|
->disableOriginalConstructor() |
|
31
|
|
|
->getMock(); |
|
32
|
|
|
|
|
33
|
|
|
$this->citationReferencePositionJournal = $this->getMockBuilder( '\SCI\CitationReferencePositionJournal' ) |
|
34
|
|
|
->disableOriginalConstructor() |
|
35
|
|
|
->getMock(); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function testCanConstruct() { |
|
39
|
|
|
|
|
40
|
|
|
$this->assertInstanceOf( |
|
41
|
|
|
'\SCI\ReferenceListFactory', |
|
42
|
|
|
new ReferenceListFactory( $this->store, $this->namespaceExaminer, $this->citationReferencePositionJournal ) |
|
43
|
|
|
); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function testCanConstructReferenceListOutputRenderer() { |
|
47
|
|
|
|
|
48
|
|
|
$instance = new ReferenceListFactory( |
|
49
|
|
|
$this->store, |
|
50
|
|
|
$this->namespaceExaminer, |
|
51
|
|
|
$this->citationReferencePositionJournal |
|
52
|
|
|
); |
|
53
|
|
|
|
|
54
|
|
|
$this->assertInstanceOf( |
|
55
|
|
|
'\SCI\ReferenceListOutputRenderer', |
|
56
|
|
|
$instance->newReferenceListOutputRenderer() |
|
57
|
|
|
); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function testCanConstructCachedReferenceListOutputRenderer() { |
|
61
|
|
|
|
|
62
|
|
|
$mediaWikiContextInteractor = $this->getMockBuilder( '\SCI\MediaWikiContextInteractor' ) |
|
63
|
|
|
->disableOriginalConstructor() |
|
64
|
|
|
->getMock(); |
|
65
|
|
|
|
|
66
|
|
|
$cache = $this->getMockBuilder( '\Onoi\Cache\Cache' ) |
|
67
|
|
|
->disableOriginalConstructor() |
|
68
|
|
|
->getMock(); |
|
69
|
|
|
|
|
70
|
|
|
$cacheKeyProvider = $this->getMockBuilder( '\SCI\CacheKeyProvider' ) |
|
71
|
|
|
->disableOriginalConstructor() |
|
72
|
|
|
->getMock(); |
|
73
|
|
|
|
|
74
|
|
|
$instance = new ReferenceListFactory( |
|
75
|
|
|
$this->store, |
|
76
|
|
|
$this->namespaceExaminer, |
|
77
|
|
|
$this->citationReferencePositionJournal |
|
78
|
|
|
); |
|
79
|
|
|
|
|
80
|
|
|
$options = new Options( [ |
|
81
|
|
|
'numberOfReferenceListColumns' => null, |
|
82
|
|
|
'referenceListType' => null, |
|
83
|
|
|
'browseLinkToCitationResource' => null, |
|
84
|
|
|
'citationReferenceCaptionFormat' => null, |
|
85
|
|
|
'responsiveMonoColumnCharacterBoundLength' => 100 |
|
86
|
|
|
] ); |
|
87
|
|
|
|
|
88
|
|
|
$this->assertInstanceOf( |
|
89
|
|
|
'\SCI\CachedReferenceListOutputRenderer', |
|
90
|
|
|
$instance->newCachedReferenceListOutputRenderer( $mediaWikiContextInteractor, $cache, $cacheKeyProvider, $options ) |
|
91
|
|
|
); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
} |
|
95
|
|
|
|