2009-05-28 06:04:51 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\DBAL\Functional\Schema;
|
|
|
|
|
|
|
|
use Doctrine\DBAL\Schema;
|
|
|
|
|
|
|
|
require_once __DIR__ . '/../../../TestInit.php';
|
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
|
2009-05-28 06:04:51 +04:00
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
2009-11-03 19:56:05 +03:00
|
|
|
* SQLITE does not support databases.
|
|
|
|
*
|
2009-06-15 22:25:47 +04:00
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testListDatabases()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->listDatabases();
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
2009-11-03 19:56:05 +03:00
|
|
|
* SQLITE does not support databases.
|
|
|
|
*
|
2009-06-15 22:25:47 +04:00
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testListFunctions()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->listFunctions();
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testListTriggers()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->listTriggers();
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testListTableConstraints()
|
|
|
|
{
|
|
|
|
// TODO: Implement support for constraints/foreign keys to be specified
|
|
|
|
// when creating tables. Sqlite does not support adding them after
|
|
|
|
// the table has already been created
|
|
|
|
$tableConstraints = $this->_sm->listTableConstraints('list_table_constraints_test');
|
2009-05-29 01:34:35 +04:00
|
|
|
$this->assertEquals(array(), $tableConstraints);
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testListUsers()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->listUsers();
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
2009-11-03 19:56:05 +03:00
|
|
|
protected function getCreateExampleViewSql()
|
2009-05-28 06:04:51 +04:00
|
|
|
{
|
2009-05-30 06:27:50 +04:00
|
|
|
$this->createTestTable('test_views');
|
2009-11-03 19:56:05 +03:00
|
|
|
return 'SELECT * from test_views';
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testCreateAndDropDatabase()
|
|
|
|
{
|
|
|
|
$path = dirname(__FILE__).'/test_create_and_drop_sqlite_database.sqlite';
|
|
|
|
|
2009-06-20 21:02:02 +04:00
|
|
|
$this->_sm->createDatabase($path);
|
2009-05-29 01:34:35 +04:00
|
|
|
$this->assertEquals(true, file_exists($path));
|
2009-06-20 21:02:02 +04:00
|
|
|
$this->_sm->dropDatabase($path);
|
2009-05-29 01:34:35 +04:00
|
|
|
$this->assertEquals(false, file_exists($path));
|
2009-06-20 21:02:02 +04:00
|
|
|
}
|
2009-05-28 06:04:51 +04:00
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testCreateSequence()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->createSequence('seqname', 1, 1);
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
2009-06-20 21:02:02 +04:00
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testCreateForeignKey()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->createForeignKey('table', array());
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testRenameTable()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->renameTable('oldname', 'newname');
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testAddTableColumn()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
return $this->_sm->addTableColumn('table', 'column', array());
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testRemoveTableColumn()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->removeTableColumn('table', 'column');
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testChangeTableColumn()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->changeTableColumn('name', 'type', null, array());
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
2009-06-15 22:25:47 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-28 06:04:51 +04:00
|
|
|
public function testRenameTableColumn()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->renameTableColumn('table', 'old', 'new', array());
|
2009-05-28 06:04:51 +04:00
|
|
|
}
|
|
|
|
}
|