Example #1
0
    public function testGenerateCreateSql()
    {
        $config = new Config(self::TEST_ENTITY);
        $sqlCreateEntity = $config->getCreateTableCode();
        $expectedSql = <<<SQL
create table if not exists obx_core_test_entity(
\tID int(11) unsigned not null auto_increment,
\tCODE varchar(15) not null,
\tNAME varchar(255) not null,
\tSORT int(11) not null default '100',
\tSOME_BCHAR char(1) not null default 'Y',
\tCREATE_TIME datetime null,
\tTIMESTAMP_X datetime null,
\tSOME_TEXT text null,
\tIBLOCK_ID int(11) not null,
\tUSER_ID int(11) null,
\tCUSTOM_CK varchar(255) null,
\tVALIDATION varchar(255) null,
\tprimary key(ID),
\tunique obx_core_test_entity_code_bchar(CODE, SOME_BCHAR),
\tindex obx_core_test_entity_code(CODE)
);

SQL;
        $this->assertEquals($expectedSql, $sqlCreateEntity);
    }