Completed
Push — develop ( 0a2cdf...062ac6 )
by Bartko
03:22
created

Doctrine2DBALWithScopeTest::getAdapter()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 25
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 16
nc 2
nop 0
1
<?php
2
namespace StefanoTreeTest\Integration\Adapter;
3
4
use Doctrine\DBAL;
5
use StefanoTree\NestedSet\Adapter\AdapterInterface as TreeAdapterInterface;
6
use StefanoTree\NestedSet\Adapter\Doctrine2DBAL as NestedSetAdapter;
7
use StefanoTree\NestedSet\Options;
8
9
10
class Doctrine2DBALWithScopeTest
11
    extends AdapterWithScopeTestAbstract
0 ignored issues
show
Coding Style introduced by
The extends keyword must be on the same line as the class name
Loading history...
12
{
13
    /**
14
     * @return TreeAdapterInterface
15
     */
16
    protected function getAdapter()
17
    {
18
        $config = new DBAL\Configuration();
19
        $connectionParams = array(
20
            'dbname' => TEST_STEFANO_DB_DB_NAME,
21
            'user' => TEST_STEFANO_DB_USER,
22
            'password' => TEST_STEFANO_DB_PASSWORD,
23
            'host' => TEST_STEFANO_DB_HOSTNAME,
24
            'driver' => 'pdo_' . strtolower(TEST_STEFANO_DB_ADAPTER),
25
        );
26
27
        $connection = DBAL\DriverManager::getConnection($connectionParams, $config);
28
29
        $options = new Options(array(
30
            'tableName' => 'tree_traversal_with_scope',
31
            'idColumnName' => 'tree_traversal_id',
32
            'scopeColumnName' => 'scope',
33
        ));
34
35
        if ('pgsql' == TEST_STEFANO_DB_ADAPTER) {
36
            $options->setSequenceName('tree_traversal_with_scope_tree_traversal_id_seq');
37
        }
38
39
        return new NestedSetAdapter($options, $connection);
40
    }
41
}
42