/**
  * test case for creating an index with a custom name
  */
 public function test_can_create_index_with_custom_name()
 {
     //create it
     $this->adapter->execute_ddl("CREATE TABLE `users` ( name varchar(20), age int(3) );");
     $base = new Ruckusing_Migration_Base($this->adapter);
     $base->add_index("users", "name", array('name' => 'my_special_index'));
     //ensure it exists
     $this->assertEquals(true, $this->adapter->has_index("users", "name", array('name' => 'my_special_index')));
     //drop it
     $base->remove_index("users", "name", array('name' => 'my_special_index'));
     $this->assertEquals(false, $this->adapter->has_index("users", "my_special_index"));
 }
 /**
  * test index name too long
  */
 public function test_index_name_too_long_throws_exception()
 {
     $bm = new Ruckusing_Migration_Base($this->adapter);
     try {
         srand();
         $table_name = "users_" . rand(0, 1000000);
         $table = $bm->create_table($table_name, array('id' => false));
         $table->column('somecolumnthatiscrazylong', 'integer');
         $table->column('anothercolumnthatiscrazylongrodeclown', 'integer');
         $sql = $table->finish();
         $bm->add_index($table_name, array('somecolumnthatiscrazylong', 'anothercolumnthatiscrazylongrodeclown'));
     } catch (Ruckusing_Exception $exception) {
         if (Ruckusing_Exception::INVALID_INDEX_NAME == $exception->getCode()) {
             $bm->drop_table($table_name);
             return;
         }
     }
     $this->fail('Expected to raise & catch Ruckusing_Exception::INVALID_INDEX_NAME');
 }