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