testParseWithUnknownType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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