Completed
Push — master ( 948d8b...d508c6 )
by smiley
03:12
created

PostgresQueryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateDatabase() 11 11 1
A testCreateTable() 7 7 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 *
4
 * @filesource   PostgresQueryTest.php
5
 * @created      12.06.2017
6
 * @package      chillerlan\DatabaseTest\Query
7
 * @author       Smiley <[email protected]>
8
 * @copyright    2017 Smiley
9
 * @license      MIT
10
 */
11
12
namespace chillerlan\DatabaseTest\Query;
13
14
use chillerlan\Database\Drivers\PostgreSQLDriver;
15
16
/**
17
 * Class PostgresQueryTest
18
 */
19 View Code Duplication
class PostgresQueryTest extends QueryTestAbstract{
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
21
	protected $driver = PostgreSQLDriver::class;
22
	protected $envVar = 'DB_POSTGRES_';
23
24
	public function testCreateDatabase(){
25
		$this->assertSame(
26
			'CREATE DATABASE "dbtest" ENCODING \'UTF8\'',
27
			$this->createDatabase()->sql()
28
		);
29
30
		$this->assertSame(
31
			'CREATE DATABASE "dbtest" ENCODING \'EUC_KR\' LC_COLLATE=\'ko_KR.euckr\' LC_CTYPE=\'ko_KR.euckr\'',
32
			$this->createDatabase()->charset('EUC_KR,ko_KR.euckr,ko_KR.euckr')->sql()
33
		);
34
	}
35
36
	public function testCreateTable(){
37
		$this->DBDriver->raw('DROP TABLE '.self::TEST_TABLENAME.'');
38
39
		var_dump($this->createTable()->sql());
0 ignored issues
show
Security Debugging Code introduced by
var_dump($this->createTable()->sql()); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
40
		var_dump($this->createTable()->execute());
41
		$this->markTestIncomplete();
42
	}
43
44
}
45