1
0
mirror of synced 2024-12-14 23:26:04 +03:00
doctrine2/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php

127 lines
2.9 KiB
PHP
Raw Normal View History

<?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-06-15 22:25:47 +04:00
/**
* SQLITE does not support databases.
*
2009-06-15 22:25:47 +04:00
* @expectedException \Exception
*/
public function testListDatabases()
{
2009-06-15 22:25:47 +04:00
$this->_sm->listDatabases();
}
2009-06-15 22:25:47 +04:00
/**
* SQLITE does not support databases.
*
2009-06-15 22:25:47 +04:00
* @expectedException \Exception
*/
public function testListFunctions()
{
2009-06-15 22:25:47 +04:00
$this->_sm->listFunctions();
}
2009-06-15 22:25:47 +04:00
/**
* @expectedException \Exception
*/
public function testListTriggers()
{
2009-06-15 22:25:47 +04:00
$this->_sm->listTriggers();
}
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');
$this->assertEquals(array(), $tableConstraints);
}
2009-06-15 22:25:47 +04:00
/**
* @expectedException \Exception
*/
public function testListUsers()
{
2009-06-15 22:25:47 +04:00
$this->_sm->listUsers();
}
protected function getCreateExampleViewSql()
{
$this->createTestTable('test_views');
return 'SELECT * from test_views';
}
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);
$this->assertEquals(true, file_exists($path));
2009-06-20 21:02:02 +04:00
$this->_sm->dropDatabase($path);
$this->assertEquals(false, file_exists($path));
2009-06-20 21:02:02 +04:00
}
2009-06-15 22:25:47 +04:00
/**
* @expectedException \Exception
*/
public function testCreateSequence()
{
2009-06-15 22:25:47 +04:00
$this->_sm->createSequence('seqname', 1, 1);
}
2009-06-20 21:02:02 +04:00
2009-06-15 22:25:47 +04:00
/**
* @expectedException \Exception
*/
public function testCreateForeignKey()
{
2009-06-15 22:25:47 +04:00
$this->_sm->createForeignKey('table', array());
}
2009-06-15 22:25:47 +04:00
/**
* @expectedException \Exception
*/
public function testRenameTable()
{
2009-06-15 22:25:47 +04:00
$this->_sm->renameTable('oldname', 'newname');
}
2009-06-15 22:25:47 +04:00
/**
* @expectedException \Exception
*/
public function testAddTableColumn()
{
2009-06-15 22:25:47 +04:00
return $this->_sm->addTableColumn('table', 'column', array());
}
2009-06-15 22:25:47 +04:00
/**
* @expectedException \Exception
*/
public function testRemoveTableColumn()
{
2009-06-15 22:25:47 +04:00
$this->_sm->removeTableColumn('table', 'column');
}
2009-06-15 22:25:47 +04:00
/**
* @expectedException \Exception
*/
public function testChangeTableColumn()
{
2009-06-15 22:25:47 +04:00
$this->_sm->changeTableColumn('name', 'type', null, array());
}
2009-06-15 22:25:47 +04:00
/**
* @expectedException \Exception
*/
public function testRenameTableColumn()
{
2009-06-15 22:25:47 +04:00
$this->_sm->renameTableColumn('table', 'old', 'new', array());
}
}