Completed
Push — master ( 23c630...ec7273 )
by
unknown
02:52
created

PropertyDataTypeLookupExceptionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructorWithOnlyRequiredArguments() 0 9 1
A testConstructorWithAllArguments() 0 10 1
1
<?php
2
3
namespace Wikibase\DataModel\Services\Tests\Lookup;
4
5
use Exception;
6
use PHPUnit_Framework_TestCase;
7
use Wikibase\DataModel\Entity\PropertyId;
8
use Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookupException;
9
10
/**
11
 * @covers Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookupException
12
 *
13
 * @licence GNU GPL v2+
14
 * @author Thiemo Mättig
15
 */
16
class PropertyDataTypeLookupExceptionTest extends PHPUnit_Framework_TestCase {
17
18
	public function testConstructorWithOnlyRequiredArguments() {
19
		$propertyId = new PropertyId( 'P1' );
20
		$exception = new PropertyDataTypeLookupException( $propertyId );
21
22
		$this->assertSame( $propertyId, $exception->getPropertyId() );
23
		$this->assertSame( 'Property data type lookup failed for: P1', $exception->getMessage() );
24
		$this->assertSame( 0, $exception->getCode() );
25
		$this->assertNull( $exception->getPrevious() );
26
	}
27
28
	public function testConstructorWithAllArguments() {
29
		$propertyId = new PropertyId( 'P1' );
30
		$previous = new Exception( 'previous' );
31
		$exception = new PropertyDataTypeLookupException( $propertyId, 'customMessage', $previous );
32
33
		$this->assertSame( $propertyId, $exception->getPropertyId() );
34
		$this->assertSame( 'customMessage', $exception->getMessage() );
35
		$this->assertSame( 0, $exception->getCode() );
36
		$this->assertSame( $previous, $exception->getPrevious() );
37
	}
38
39
}
40