Passed
Push — master ( f21277...f08cc9 )
by Aimeos
04:50
created

PgSQLTest::testGetConditionSource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2018
6
 */
7
8
9
namespace Aimeos\MW\Criteria;
10
11
12
class PgSQLTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $object;
15
16
17
	protected function setUp()
18
	{
19
		if( \TestHelperMw::getConfig()->get( 'resource/db/adapter', false ) === false ) {
20
			$this->markTestSkipped( 'No database configured' );
21
		}
22
23
24
		$dbm = \TestHelperMw::getDBManager();
25
26
		$conn = $dbm->acquire();
27
		$this->object = new \Aimeos\MW\Criteria\PgSQL( $conn );
28
		$dbm->release( $conn );
29
	}
30
31
32
	protected function tearDown()
33
	{
34
		unset( $this->object );
35
	}
36
37
38
	public function testCompare()
39
	{
40
		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Expression\\Compare\\PgSQL', $this->object->compare( '!=', 'name', 'value' ) );
41
	}
42
43
44
	public function testGetConditionSource()
45
	{
46
		$types = array( 'column' => \Aimeos\MW\DB\Statement\Base::PARAM_BOOL);
47
		$this->object->setConditions( $this->object->compare( '==', 'column', 0 ) );
48
		$this->assertEquals( "column = 'f'", $this->object->getConditionSource( $types ) );
49
50
		$types = array( 'column' => \Aimeos\MW\DB\Statement\Base::PARAM_BOOL);
51
		$this->object->setConditions( $this->object->compare( '==', 'column', 1 ) );
52
		$this->assertEquals( "column = 't'", $this->object->getConditionSource( $types ) );
53
	}
54
}
55