WikibaseValueParserTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 16
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testParse() 0 6 1
A testParseWithUnknownType() 0 6 1
1
<?php
2
3
namespace PPP\Wikidata\ValueParsers;
4
5
use DataValues\BooleanValue;
6
use ValueParsers\BoolParser;
7
8
/**
9
 * @covers PPP\Wikidata\ValueParsers\WikibaseValueParser
10
 *
11
 * @licence AGPLv3+
12
 * @author Thomas Pellissier Tanon
13
 */
14
class WikibaseValueParserTest extends \PHPUnit_Framework_TestCase {
15
16
	public function testParse() {
17
		$parser = new WikibaseValueParser(array(
18
			'bool' => new BoolParser()
19
		));
20
		$this->assertEquals(array(new BooleanValue(true)), $parser->parse('true', 'bool'));
21
	}
22
23
	public function testParseWithUnknownType() {
24
		$parser = new WikibaseValueParser(array());
25
26
		$this->setExpectedException('ValueParsers\ParseException');
27
		$parser->parse('true', 'bool');
28
	}
29
}
30