TermStoreInstallerTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Tests\Queryr\TermStore;
4
5
use Doctrine\DBAL\DriverManager;
6
use Doctrine\DBAL\Schema\AbstractSchemaManager;
7
use PHPUnit\Framework\TestCase;
8
use Queryr\TermStore\TermStoreConfig;
9
use Queryr\TermStore\TermStoreInstaller;
10
11
/**
12
 * @covers \Queryr\TermStore\TermStoreInstaller
13
 *
14
 * @licence GNU GPL v2+
15
 * @author Jeroen De Dauw < [email protected] >
16
 */
17
class TermStoreInstallerTest extends TestCase {
18
19
	/**
20
	 * @var TermStoreInstaller
21
	 */
22
	private $storeInstaller;
23
24
	/**
25
	 * @var AbstractSchemaManager
26
	 */
27
	private $schemaManager;
28
29
	public function setUp() {
30
		$connection = DriverManager::getConnection( array(
31
			'driver' => 'pdo_sqlite',
32
			'memory' => true,
33
		) );
34
35
		$this->schemaManager = $connection->getSchemaManager();
36
		$this->storeInstaller = new TermStoreInstaller( $this->schemaManager, new TermStoreConfig( 'kittens_' ) );
37
	}
38
39
	public function testInstallationAndRemoval() {
40
		$this->storeInstaller->install();
41
42
		$this->assertTrue( $this->schemaManager->tablesExist( 'kittens_labels' ) );
0 ignored issues
show
Documentation introduced by
'kittens_labels' is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
43
		$this->assertTrue( $this->schemaManager->tablesExist( 'kittens_aliases' ) );
0 ignored issues
show
Documentation introduced by
'kittens_aliases' is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
44
45
		$this->storeInstaller->uninstall();
46
47
		$this->assertFalse( $this->schemaManager->tablesExist( 'kittens_labels' ) );
0 ignored issues
show
Documentation introduced by
'kittens_labels' is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
48
		$this->assertFalse( $this->schemaManager->tablesExist( 'kittens_aliases' ) );
0 ignored issues
show
Documentation introduced by
'kittens_aliases' is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
49
	}
50
51
	public function testStoresPage() {
52
		$this->storeInstaller->install();
53
		$this->assertTrue( true );
54
	}
55
56
}
57