Completed
Push — develop ( 66df04...390d88 )
by Bartko
03:53
created

StefanoDbWithScopeTest::getAdapter()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
cc 2
eloc 14
nc 2
nop 0
1
<?php
2
namespace StefanoTreeTest\Integration\Adapter;
3
4
use StefanoTree\NestedSet\Adapter\AdapterInterface as TreeAdapterInterface;
5
use StefanoTree\NestedSet\Adapter\StefanoDb as NestedSetAdapter;
6
use StefanoTree\NestedSet\Options;
7
use Zend\Db\Adapter\Adapter as DbAdapter;
8
9
10
class StefanoDbWithScopeTest
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
        $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_with_scope',
28
            'idColumnName' => 'tree_traversal_id',
29
            'scopeColumnName' => 'scope',
30
        ));
31
32
        if ('pgsql' == TEST_STEFANO_DB_ADAPTER) {
33
            $options->setSequenceName('tree_traversal_with_scope_tree_traversal_id_seq');
34
        }
35
36
        return new NestedSetAdapter($options, $dbAdapter);
37
    }
38
}
39