Completed
Push — develop ( 4c851b...fa6865 )
by Freddie
03:54
created

ColumnTest::testItDefinition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 16
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of FlexPHP.
4
 *
5
 * (c) Freddie Gar <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace FlexPHP\Database\Tests;
11
12
use FlexPHP\Database\Column;
13
use FlexPHP\Schema\SchemaAttribute;
14
15
class ColumnTest extends TestCase
16
{
17
    public function testItDefinition(): void
18
    {
19
        $schemaAttribute = new SchemaAttribute('foo', 'string', [
20
            'min' => 10,
21
            'max' => 100,
22
        ]);
23
24
        $column = new Column($schemaAttribute);
25
26
        $this->assertEquals($schemaAttribute->name(), $column->getName());
27
        $this->assertEquals($schemaAttribute->dataType(), $column->getType());
28
        $this->assertEquals([
29
            'length' => $schemaAttribute->maxLength(),
30
            'notnull' => $schemaAttribute->isRequired(),
31
            'comment' => $schemaAttribute->name(),
32
        ], $column->getOptions());
33
    }
34
}
35