1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/tests/ExportMysqlTestCase.php

55 lines
1.8 KiB
PHP
Raw Normal View History

<?php
2006-11-24 02:23:24 +03:00
class Doctrine_Export_Mysql_TestCase extends Doctrine_Driver_UnitTestCase {
public function __construct() {
parent::__construct('mysql');
2006-11-23 02:35:34 +03:00
}
public function testAlterTableThrowsExceptionWithoutValidTableName() {
try {
$this->export->alterTable(0,0,array());
$this->fail();
} catch(Doctrine_Export_Exception $e) {
$this->pass();
}
}
public function testCreateTableExecutesSql() {
$name = 'mytable';
2006-11-25 02:23:52 +03:00
$fields = array('id' => array('type' => 'integer', 'unsigned' => 1));
$options = array('type' => 'foo');
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT) ENGINE = foo');
}
public function testCreateTableSupportsAutoincPks() {
$name = 'mytable';
2006-11-23 02:35:34 +03:00
2006-11-25 02:23:52 +03:00
$fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true));
2006-11-23 02:35:34 +03:00
$options = array('type' => 'foo');
2006-11-25 02:23:52 +03:00
$this->export->createTable($name, $fields, $options);
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT) ENGINE = foo');
2006-11-23 02:35:34 +03:00
}
public function testCreateDatabaseExecutesSql() {
$this->export->createDatabase('db');
$this->assertEqual($this->adapter->pop(), 'CREATE DATABASE db');
}
public function testDropDatabaseExecutesSql() {
$this->export->dropDatabase('db');
$this->assertEqual($this->adapter->pop(), 'DROP DATABASE db');
}
public function testDropIndexExecutesSql() {
$this->export->dropIndex('sometable', 'relevancy');
2006-11-25 02:23:52 +03:00
$this->assertEqual($this->adapter->pop(), 'DROP INDEX relevancy_idx ON sometable');
}
2006-11-25 02:23:52 +03:00
}
?>