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 ConnectionTest 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 testNonPersistentConnection() |
|
0 ignored issues
–
show
|
|||
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-nonpersistent connection established'); |
||
33 | } |
||
34 | |||
35 | View Code Duplication | public function testPersistentConnection() |
|
0 ignored issues
–
show
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...
|
|||
36 | { |
||
37 | $params = $this->_conn->getParams(); |
||
38 | $params['persistent'] = true; |
||
39 | |||
40 | $conn = DriverManager::getConnection($params); |
||
41 | |||
42 | $conn->connect(); |
||
43 | |||
44 | self::assertTrue($conn->isConnected(), 'No SQLAnywhere-persistent connection established'); |
||
45 | } |
||
46 | } |
||
47 |
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.