Completed
Push — master ( c7757e...39cb21 )
by Luís
16s
created

StatementTest::testNonPersistentStatement()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace Doctrine\Tests\DBAL\Functional\Driver\SQLAnywhere;
4
5
use Doctrine\DBAL\Driver\SQLAnywhere\Driver;
6
use Doctrine\DBAL\DriverManager;
7
8
class StatementTest extends \Doctrine\Tests\DbalFunctionalTestCase
9
{
10
    protected function setUp()
11
    {
12
        if (! extension_loaded('sqlanywhere')) {
13
            $this->markTestSkipped('sqlanywhere is not installed.');
14
        }
15
16
        parent::setUp();
17
18
        if (! $this->_conn->getDriver() instanceof Driver) {
19
            $this->markTestSkipped('sqlanywhere only test.');
20
        }
21
    }
22
23 View Code Duplication
    public function testNonPersistentStatement()
0 ignored issues
show
Duplication introduced by
This method 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...
24
    {
25
        $params = $this->_conn->getParams();
26
        $params['persistent'] = false;
27
28
        $conn = DriverManager::getConnection($params);
29
30
        $conn->connect();
31
32
        self::assertTrue($conn->isConnected(),'No SQLAnywhere-Connection established');
33
34
        $prepStmt = $conn->prepare('SELECT 1');
35
        self::assertTrue($prepStmt->execute(),' Statement non-persistent failed');
36
    }
37
38 View Code Duplication
    public function testPersistentStatement()
0 ignored issues
show
Duplication introduced by
This method 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...
39
    {
40
        $params = $this->_conn->getParams();
41
        $params['persistent'] = true;
42
43
        $conn = DriverManager::getConnection($params);
44
45
        $conn->connect();
46
47
        self::assertTrue($conn->isConnected(),'No SQLAnywhere-Connection established');
48
49
        $prepStmt = $conn->prepare('SELECT 1');
50
        self::assertTrue($prepStmt->execute(),' Statement persistent failed');
51
    }
52
53
}
54