Passed
Push — phpstan-tests ( 6a2b78...974220 )
by Michael
61:35 queued 23s
created

ComparatorTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 14
dl 0
loc 41
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A defaultValueProvider() 0 5 1
A testDefaultValueComparison() 0 10 1
A setUp() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\DBAL\Functional\Schema;
6
7
use Doctrine\DBAL\Schema\AbstractSchemaManager;
8
use Doctrine\DBAL\Schema\Comparator;
9
use Doctrine\DBAL\Schema\Table;
10
use Doctrine\Tests\DbalFunctionalTestCase;
11
12
class ComparatorTest extends DbalFunctionalTestCase
13
{
14
    /** @var AbstractSchemaManager */
15
    private $schemaManager;
16
17
    /** @var Comparator */
18
    private $comparator;
19
20
    protected function setUp() : void
21
    {
22
        parent::setUp();
23
24
        $this->schemaManager = $this->connection->getSchemaManager();
25
        $this->comparator    = new Comparator();
26
    }
27
28
    /**
29
     * @param mixed $value
30
     *
31
     * @dataProvider defaultValueProvider
32
     */
33
    public function testDefaultValueComparison(string $type, $value) : void
34
    {
35
        $table = new Table('default_value');
36
        $table->addColumn('test', $type, ['default' => $value]);
37
38
        $this->schemaManager->dropAndCreateTable($table);
39
40
        $onlineTable = $this->schemaManager->listTableDetails('default_value');
41
42
        self::assertFalse($this->comparator->diffTable($table, $onlineTable));
43
    }
44
45
    /**
46
     * @return mixed[][]
47
     */
48
    public static function defaultValueProvider() : iterable
49
    {
50
        return [
51
            ['integer', 1],
52
            ['boolean', false],
53
        ];
54
    }
55
}
56