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

IntegrationTestCase   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getConnection() 0 4 1
A setUp() 0 6 1
A tearDown() 0 5 1
A assertCompareDataSet() 0 6 1
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