Completed
Push — master ( d44724...37cbf9 )
by no
05:17
created

testConstructWithAllArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace Wikibase\DataModel\Services\Tests\Lookup;
4
5
use Exception;
6
use Wikibase\DataModel\Services\Lookup\UnknownForeignRepositoryException;
7
8
/**
9
 * @covers Wikibase\DataModel\Services\Lookup\UnknownForeignRepositoryException
10
 *
11
 * @license GPL-2.0+
12
 */
13
class UnknownForeignRepositoryExceptionTest extends \PHPUnit_Framework_TestCase {
14
15
	public function testConstructWithRepositoryNameOnly() {
16
		$exception = new UnknownForeignRepositoryException( 'foo' );
17
18
		$this->assertSame( 'foo', $exception->getRepositoryName() );
19
		$this->assertSame( 'Unknown repository name: foo', $exception->getMessage() );
20
		$this->assertSame( 0, $exception->getCode() );
21
		$this->assertNull( $exception->getPrevious() );
22
	}
23
24
	public function testConstructWithAllArguments() {
25
		$previous = new Exception();
26
		$exception = new UnknownForeignRepositoryException( 'foo', 'No such repository: foo', $previous );
27
28
		$this->assertSame( 'foo', $exception->getRepositoryName() );
29
		$this->assertSame( 'No such repository: foo', $exception->getMessage() );
30
		$this->assertSame( 0, $exception->getCode() );
31
		$this->assertSame( $previous, $exception->getPrevious() );
32
	}
33
34
}
35