Exemplo n.º 1
0
 public function testAddArrayTable()
 {
     $database = new Database();
     $database->addTable(['name' => 'books']);
     $database->addTable(['name' => 'authors']);
     $database->addTable(['name' => 'categories', 'skipSql' => 'true']);
     $database->addTable(['name' => 'publishers', 'readOnly' => 'true']);
     $this->assertTrue($database->hasTable('books'));
     $this->assertTrue($database->hasTable('books', true));
     $this->assertFalse($database->hasTable('BOOKS'));
     $this->assertTrue($database->hasTableByPhpName('Books'));
     $this->assertInstanceOf('Propel\\Generator\\Model\\Table', $database->getTable('books'));
     $this->assertInstanceOf('Propel\\Generator\\Model\\Table', $database->getTableByPhpName('Books'));
     // 3 tables because read only table is excluded from the count
     $this->assertSame(3, $database->countTables());
     // 3 tables because skipped sql table is excluded from the count
     $this->assertCount(3, $database->getTablesForSql());
 }