Beispiel #1
0
 /**
  */
 public function testIndexes()
 {
     try {
         $this->object->indexes('');
         $this->fail('indexes does not accept empty string for table name!');
     } catch (Phigrate_Exception_Argument $ex) {
         $msg = 'Missing table name parameter';
         $this->assertEquals($msg, $ex->getMessage());
     }
     $sql = "CREATE TABLE `users` (id int(11) NOT NULL, name varchar(20), age int(3), " . "title varchar(20), extid int(5) NOT NULL, PRIMARY KEY (id));";
     $this->object->executeDdl($sql);
     $this->object->addIndex('users', 'name');
     $this->object->addIndex('users', 'extid', array('unique' => true));
     $expected = array(array('name' => 'idx_users_extid', 'unique' => true), array('name' => 'idx_users_name', 'unique' => false));
     $this->assertSame($expected, $this->object->indexes('users'));
 }