Completed
Push — develop ( 416a58...81066f )
by Bartko
02:20
created

IntegrationTestCase::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace StefanoTreeTest;
6
7
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
8
use PHPUnit\DbUnit\TestCaseTrait;
9
use PHPUnit\Framework\TestCase;
10
11
abstract class IntegrationTestCase extends TestCase
12
{
13
    use TestCaseTrait {
14
        TestCaseTrait::setUp as traitSetUp;
15
        TestCaseTrait::tearDown as traitTearDown;
16
    }
17
    use MockeryPHPUnitIntegration;
18
19
    protected function getConnection()
20
    {
21
        return $this->createDefaultDBConnection(TestUtil::getPDOConnection());
22
    }
23
24
    protected function setUp()
25
    {
26
        TestUtil::createDbScheme();
27
        $this->traitSetUp();
28
        parent::setUp();
29
    }
30
31
    protected function tearDown()
32
    {
33
        $this->traitTearDown();
34
        parent::tearDown();
35
    }
36
37
    protected function assertCompareDataSet(array $tables, $expectedDataSetXmlFile)
38
    {
39
        $dataSet = $this->getConnection()->createDataSet($tables);
40
        $expectedDataSet = $this->createMySQLXMLDataSet($expectedDataSetXmlFile);
41
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
42
    }
43
}
44