Exemple #1
0
 /**
  * @coversNothing
  * @todo What does this test exactly?
  */
 public function testCheckColumns()
 {
     /**
      * Column
      */
     $column = new Table\Column(['Field' => 'id', 'Type' => 'int(10) unsigned', 'Collation' => '', 'Null' => 'NO', 'Key' => 'MUL', 'Default' => '', 'Extra' => 'auto_increment']);
     $columnResult = $column->getResult();
     $columns = new Table\ColumnCollection();
     $columns->add($column);
     /**
      * Table
      */
     $table = new Table(null, null, new Table\ColumnCollection(), new Table\IndexCollection());
     $tableResult = $table->checkColumns($columns);
     $this->assertSame($columnResult, $tableResult);
 }
Exemple #2
0
 /**
  * @covers ::getResult
  */
 public function testCheckAutoIncrement()
 {
     /**
      * Auto increment
      */
     $row = ['Field' => 'id', 'Type' => 'int(10) unsigned', 'Collation' => '', 'Null' => 'NO', 'Key' => 'MUL', 'Default' => '', 'Extra' => 'auto_increment'];
     $column = new Column($row);
     $result = $column->getResult();
     $this->assertGreaterThan(0, count($result));
     $this->assertTrue(in_array('Set as auto_increment but has no primary key', $result[0]));
     /**
      * Regular
      */
     $row = ['Field' => 'modified', 'Type' => 'datetime', 'Collation' => '', 'Null' => 'NO', 'Key' => '', 'Default' => '', 'Extra' => ''];
     $column = new Column($row);
     $result = $column->getResult();
     $this->assertSame(0, count($result));
 }