MediawikiArticleTest::testGetHeaderText()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
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