Completed
Push — master ( 9de5b8...ddab96 )
by Matteo
03:46
created

BridgeTestCase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 4
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 1
A loadFixtures() 0 11 1
1
<?php
2
3
use Mattbit\MysqlCompat\Bridge;
4
use Mattbit\MysqlCompat\Manager;
5
6
class BridgeTestCase extends FunctionalTestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
    /**
9
     * @var Bridge
10
     */
11
    protected $bridge;
12
13
    /**
14
     * @var \PDO
15
     */
16
    protected $db;
17
18
    public function setUp()
19
    {
20
        $manager = new Manager(new \Mattbit\MysqlCompat\ConnectionFactory());
21
        $this->bridge = new Bridge($manager);
22
23
        $this->bridge->connect($this->config['dbhost'], $this->config['dbuser'], $this->config['dbpass']);
24
        $this->bridge->selectDb($this->config['dbname']);
25
26
        $this->loadFixtures();
27
    }
28
29
    protected function loadFixtures()
30
    {
31
        $dbname = $this->config['dbname'];
32
        $dbhost = $this->config['dbhost'];
33
        $dbuser = $this->config['dbuser'];
34
        $dbpass = $this->config['dbpass'];
35
36
        $this->db = new PDO("mysql:dbname=$dbname;host=$dbhost", $dbuser, $dbpass);
37
        $sql = file_get_contents(__DIR__.'/fixtures.sql');
38
        $this->db->query($sql);
39
    }
40
}