Completed
Push — develop ( 32afc4...f78f16 )
by Bartko
03:00
created

NestedSetWithDoctrine2DbAdapterTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 2
c 3
b 1
f 1
lcom 0
cbo 6
dl 0
loc 29
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getTreeAdapter() 0 25 2
1
<?php
2
namespace StefanoTreeTest\Integration;
3
4
use StefanoTree\NestedSet as TreeAdapter;
5
use StefanoTree\NestedSet\Adapter\Doctrine2DBALAdapter;
6
use StefanoTree\NestedSet\Options;
7
8
class NestedSetWithDoctrine2DbAdapterTest
9
    extends AbstractTest
0 ignored issues
show
Coding Style introduced by
The extends keyword must be on the same line as the class name
Loading history...
10
{
11
    protected function getTreeAdapter()
12
    {
13
        $config = new \Doctrine\DBAL\Configuration();
14
15
        $connectionParams = array(
16
            'dbname' => TEST_STEFANO_DB_DB_NAME,
17
            'user' => TEST_STEFANO_DB_USER,
18
            'password' => TEST_STEFANO_DB_PASSWORD,
19
            'host' => TEST_STEFANO_DB_HOSTNAME,
20
            'driver' => 'pdo_' . strtolower(TEST_STEFANO_DB_ADAPTER),
21
        );
22
23
        $connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
24
25
        $options = new Options(array(
26
            'tableName' => 'tree_traversal',
27
            'idColumnName' => 'tree_traversal_id',
28
        ));
29
30
        if ('pgsql' == TEST_STEFANO_DB_ADAPTER) {
31
            $options->setSequenceName('tree_traversal_tree_traversal_id_seq');
32
        }
33
34
        return new TreeAdapter(new Doctrine2DBALAdapter($options, $connection));
35
    }
36
}
37