for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?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
*
* @licence GNU GPL v2+
* @author Thiemo Mättig
*/
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() {
$previous = new Exception( 'previous' );
$exception = new PropertyDataTypeLookupException( $propertyId, 'customMessage', $previous );
$this->assertSame( 'customMessage', $exception->getMessage() );
$this->assertSame( $previous, $exception->getPrevious() );