Contao\CoreBundle\Test\Doctrine\Schema\DcaSchemaProviderTest::testCreateSchema PHP Method

testCreateSchema() public method

Tests creating a schema.
public testCreateSchema ( array $dca = [], array $sql = [] )
$dca array
$sql array
    public function testCreateSchema(array $dca = [], array $sql = [])
    {
        $schema = $this->getProvider($dca, $sql)->createSchema();
        $this->assertCount(1, $schema->getTableNames());
        $this->assertTrue($schema->hasTable('tl_member'));
        $table = $schema->getTable('tl_member');
        $this->assertTrue($table->hasColumn('id'));
        $this->assertEquals('integer', $table->getColumn('id')->getType()->getName());
        $this->assertEquals(true, $table->getColumn('id')->getNotnull());
        $this->assertEquals(0, $table->getColumn('id')->getDefault());
        $this->assertEquals(false, $table->getColumn('id')->getFixed());
        $this->assertTrue($table->hasColumn('pid'));
        $this->assertEquals('integer', $table->getColumn('pid')->getType()->getName());
        $this->assertEquals(false, $table->getColumn('pid')->getNotnull());
        $this->assertEquals(false, $table->getColumn('pid')->getFixed());
        $this->assertTrue($table->hasColumn('title'));
        $this->assertEquals('string', $table->getColumn('title')->getType()->getName());
        $this->assertEquals(true, $table->getColumn('title')->getNotnull());
        $this->assertEquals('', $table->getColumn('title')->getDefault());
        $this->assertEquals(false, $table->getColumn('title')->getFixed());
        $this->assertEquals(128, $table->getColumn('title')->getLength());
        $this->assertTrue($table->hasColumn('teaser'));
        $this->assertEquals('text', $table->getColumn('teaser')->getType()->getName());
        $this->assertEquals(false, $table->getColumn('teaser')->getNotnull());
        $this->assertEquals(false, $table->getColumn('teaser')->getFixed());
        $this->assertEquals(MySqlPlatform::LENGTH_LIMIT_TINYTEXT, $table->getColumn('teaser')->getLength());
        $this->assertTrue($table->hasColumn('description'));
        $this->assertEquals('text', $table->getColumn('description')->getType()->getName());
        $this->assertEquals(false, $table->getColumn('description')->getNotnull());
        $this->assertEquals(false, $table->getColumn('description')->getFixed());
        $this->assertEquals(MySqlPlatform::LENGTH_LIMIT_TEXT, $table->getColumn('description')->getLength());
        $this->assertTrue($table->hasColumn('content'));
        $this->assertEquals('text', $table->getColumn('content')->getType()->getName());
        $this->assertEquals(false, $table->getColumn('content')->getNotnull());
        $this->assertEquals(false, $table->getColumn('content')->getFixed());
        $this->assertEquals(MySqlPlatform::LENGTH_LIMIT_MEDIUMTEXT, $table->getColumn('content')->getLength());
        $this->assertTrue($table->hasColumn('price'));
        $this->assertEquals('decimal', $table->getColumn('price')->getType()->getName());
        $this->assertEquals(true, $table->getColumn('price')->getNotnull());
        $this->assertEquals('0.00', $table->getColumn('price')->getDefault());
        $this->assertEquals(false, $table->getColumn('price')->getFixed());
        $this->assertEquals(6, $table->getColumn('price')->getPrecision());
        $this->assertEquals(2, $table->getColumn('price')->getScale());
        $this->assertTrue($table->hasColumn('thumb'));
        $this->assertEquals('blob', $table->getColumn('thumb')->getType()->getName());
        $this->assertEquals(false, $table->getColumn('thumb')->getNotnull());
        $this->assertEquals(false, $table->getColumn('thumb')->getFixed());
        $this->assertEquals(MySqlPlatform::LENGTH_LIMIT_TINYBLOB, $table->getColumn('thumb')->getLength());
        $this->assertTrue($table->hasColumn('image'));
        $this->assertEquals('blob', $table->getColumn('image')->getType()->getName());
        $this->assertEquals(false, $table->getColumn('image')->getNotnull());
        $this->assertEquals(false, $table->getColumn('image')->getFixed());
        $this->assertEquals(MySqlPlatform::LENGTH_LIMIT_BLOB, $table->getColumn('image')->getLength());
        $this->assertTrue($table->hasColumn('attachment'));
        $this->assertEquals('blob', $table->getColumn('attachment')->getType()->getName());
        $this->assertEquals(false, $table->getColumn('attachment')->getNotnull());
        $this->assertEquals(false, $table->getColumn('attachment')->getFixed());
        $this->assertEquals(MySqlPlatform::LENGTH_LIMIT_MEDIUMBLOB, $table->getColumn('attachment')->getLength());
        $this->assertTrue($table->hasColumn('published'));
        $this->assertEquals('string', $table->getColumn('published')->getType()->getName());
        $this->assertEquals(true, $table->getColumn('published')->getNotnull());
        $this->assertEquals('', $table->getColumn('title')->getDefault());
        $this->assertEquals(true, $table->getColumn('published')->getFixed());
    }