|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PPP\Wikidata\Wikipedia; |
|
4
|
|
|
|
|
5
|
|
|
use Wikibase\DataModel\SiteLink; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* @covers PPP\Wikidata\Wikipedia\MediawikiArticle |
|
9
|
|
|
* |
|
10
|
|
|
* @licence MIT |
|
11
|
|
|
* @author Thomas Pellissier Tanon |
|
12
|
|
|
*/ |
|
13
|
|
|
class MediawikiArticleTest extends \PHPUnit_Framework_TestCase { |
|
14
|
|
|
|
|
15
|
|
|
public function testGetSiteLink() { |
|
16
|
|
|
$articleHeader = new MediawikiArticle(new SiteLink('enwiki', 'bar'), 'foo', 'en', 'http://test.org'); |
|
17
|
|
|
$this->assertEquals(new SiteLink('enwiki', 'bar'), $articleHeader->getSiteLink()); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
public function testGetHeaderText() { |
|
21
|
|
|
$articleHeader = new MediawikiArticle(new SiteLink('enwiki', 'bar'), 'foo', 'en', 'http://test.org'); |
|
22
|
|
|
$this->assertEquals('foo', $articleHeader->getHeaderText()); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
public function testGetLanguageCode() { |
|
26
|
|
|
$articleHeader = new MediawikiArticle(new SiteLink('enwiki', 'bar'), 'foo', 'en', 'http://test.org'); |
|
27
|
|
|
$this->assertEquals('en', $articleHeader->getLanguageCode()); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function testGetUrl() { |
|
31
|
|
|
$articleHeader = new MediawikiArticle(new SiteLink('enwiki', 'bar'), 'foo', 'en', 'http://test.org'); |
|
32
|
|
|
$this->assertEquals('http://test.org', $articleHeader->getUrl()); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function testGetImage() { |
|
36
|
|
|
$articleHeader = new MediawikiArticle( |
|
37
|
|
|
new SiteLink('enwiki', 'bar'), |
|
38
|
|
|
'foo', |
|
39
|
|
|
'en', |
|
40
|
|
|
'http://test.org', |
|
41
|
|
|
new MediawikiArticleImage('http://test.org', 1, 1, 'foo') |
|
42
|
|
|
); |
|
43
|
|
|
$this->assertEquals('foo', $articleHeader->getHeaderText()); |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
|