TermStoreExceptionTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 6
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A testInsertWhenStoreNotInstalledCausesTermStoreException() 0 9 1
1
<?php
2
3
namespace Tests\Queryr\TermStore;
4
5
use Doctrine\DBAL\DriverManager;
6
use PHPUnit\Framework\TestCase;
7
use Queryr\TermStore\TermStore;
8
use Queryr\TermStore\TermStoreConfig;
9
use Queryr\TermStore\TermStoreException;
10
use Wikibase\DataModel\Entity\ItemId;
11
use Wikibase\DataModel\Term\Fingerprint;
12
13
/**
14
 * @covers \Queryr\TermStore\TermStore
15
 *
16
 * @licence GNU GPL v2+
17
 * @author Jeroen De Dauw < [email protected] >
18
 */
19
class TermStoreExceptionTest extends TestCase {
20
21
	/**
22
	 * @var TermStore
23
	 */
24
	private $store;
25
26
	public function setUp() {
27
		$connection = DriverManager::getConnection( array(
28
			'driver' => 'pdo_sqlite',
29
			'memory' => true,
30
		) );
31
32
		$this->store = new TermStore( $connection, new TermStoreConfig( '' ) );
33
	}
34
35
	public function testInsertWhenStoreNotInstalledCausesTermStoreException() {
36
		$id = new ItemId( 'Q1337' );
37
38
		$fingerprint = new Fingerprint();
39
		$fingerprint->setLabel( 'en', 'EN label' );
40
41
		$this->expectException( TermStoreException::class );
42
		$this->store->storeEntityFingerprint( $id, $fingerprint );
43
	}
44
45
}
46