Completed
Push — master ( 9afe40...e40e95 )
by Luís
21s queued 15s
created

ComparatorTest::defaultValueProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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()
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