Test Failed
Push — zf3-version ( 8a740a...f2c5f0 )
by Diego
03:23
created

DistributionReportTransactionScriptTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
/**
3
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
4
 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
5
 * @license   http://framework.zend.com/license/new-bsd New BSD License
6
 */
7
8
namespace ApiTest\Controller;
9
10
use PDO;
11
use Api\Model\DistributionReportTransactionScript;
12
use Zend\Stdlib\ArrayUtils;
13
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
14
use PHPUnit\DbUnit\TestCaseTrait;
15
16
class DistributionReportTransactionScriptTest extends AbstractHttpControllerTestCase
17
{
18
    use TestCaseTrait;
19
20
    private static $pdo = null;
21
22
    private $conn = null;
23
24
    public function setUp()
25
    {
26
        $configOverrides = [];
27
28
        $this->setApplicationConfig(ArrayUtils::merge(
29
            include __DIR__ . '/../../../../config/application.config.php',
30
            $configOverrides
31
        ));
32
33
        $services = $this->getApplicationServiceLocator();
34
        $config = $services->get('config');
35
        unset($config['db']);
36
        $services->setAllowOverride(true);
37
        $services->setService('config', $config);
38
        $services->setAllowOverride(false);
39
40
        parent::setUp();
41
    }
42
43
    final public function getConnection()
44
    {
45
        if ($this->conn === null) {
46
            if (self::$pdo == null) {
47
                self::$pdo = new PDO('sqlite::memory:');
48
            }
49
            $this->conn = $this->createDefaultDBConnection(self::$pdo, ':memory:');
50
        }
51
52
        return $this->conn;
53
    }
54
55
    protected function getDataSet()
56
    {
57
        return $this->createXMLDataSet(__DIR__ . '/../fixtures/database.xml');
58
    }
59
}