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

Zend2Test   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAdapter() 0 21 2
1
<?php
2
namespace StefanoTreeTest\Integration\Adapter;
3
4
use StefanoTree\NestedSet\Adapter\AdapterInterface as TreeAdapterInterface;
5
use StefanoTree\NestedSet\Adapter\Zend2 as NestedSetAdapter;
6
use StefanoTree\NestedSet\Options;
7
use Zend\Db\Adapter\Adapter as DbAdapter;
8
9
10
class Zend2Test
11
    extends AdapterTestAbstract
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
        $dbAdapter = new DbAdapter(array(
19
            'driver' => 'Pdo_' . ucfirst(TEST_STEFANO_DB_ADAPTER),
20
            'hostname' => TEST_STEFANO_DB_HOSTNAME,
21
            'database' => TEST_STEFANO_DB_DB_NAME,
22
            'username' => TEST_STEFANO_DB_USER,
23
            'password' => TEST_STEFANO_DB_PASSWORD
24
        ));
25
26
        $options = new Options(array(
27
            'tableName' => 'tree_traversal',
28
            'idColumnName' => 'tree_traversal_id',
29
        ));
30
31
        if ('pgsql' == TEST_STEFANO_DB_ADAPTER) {
32
            $options->setSequenceName('tree_traversal_tree_traversal_id_seq');
33
        }
34
35
        return new NestedSetAdapter($options, $dbAdapter);
36
    }
37
}
38