2009-05-30 06:27:50 +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 OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
|
2009-05-30 06:27:50 +04:00
|
|
|
{
|
2009-11-03 19:56:05 +03:00
|
|
|
public function setUp()
|
2009-05-30 06:27:50 +04:00
|
|
|
{
|
2009-11-03 19:56:05 +03:00
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
if(!isset($GLOBALS['db_username'])) {
|
|
|
|
$this->markTestSkipped('Foo');
|
|
|
|
}
|
|
|
|
|
|
|
|
$username = $GLOBALS['db_username'];
|
|
|
|
|
|
|
|
$query = "GRANT ALL PRIVILEGES TO ".$username;
|
|
|
|
|
|
|
|
$conn = \Doctrine\Tests\TestUtil::getTempConnection();
|
|
|
|
$conn->executeUpdate($query);
|
2009-05-30 06:27:50 +04:00
|
|
|
}
|
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
/**
|
|
|
|
* @expectedException \Exception
|
|
|
|
*/
|
2009-05-30 06:27:50 +04:00
|
|
|
public function testListTriggers()
|
|
|
|
{
|
2009-06-15 22:25:47 +04:00
|
|
|
$this->_sm->listTriggers();
|
2009-05-30 06:27:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testListTableConstraints()
|
|
|
|
{
|
|
|
|
$this->createTestTable('test_constraints');
|
|
|
|
$tableConstraints = $this->_sm->listTableConstraints('test_constraints');
|
|
|
|
$this->assertEquals(2, count($tableConstraints));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testListUsers()
|
|
|
|
{
|
|
|
|
$users = $this->_sm->listUsers();
|
|
|
|
$this->assertEquals(true, is_array($users));
|
|
|
|
$params = $this->_conn->getParams();
|
|
|
|
$testUser = strtoupper($params['user']);
|
|
|
|
$found = false;
|
|
|
|
foreach ($users as $user) {
|
|
|
|
if ($user['user'] == $testUser) {
|
|
|
|
$found = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->assertEquals(true, $found);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testListViews()
|
|
|
|
{
|
|
|
|
$this->_sm->dropAndCreateView('test_create_view', 'SELECT * FROM sys.user_tables');
|
|
|
|
|
|
|
|
$views = $this->_sm->listViews();
|
|
|
|
$view = end($views);
|
|
|
|
|
|
|
|
$this->assertEquals('TEST_CREATE_VIEW', $view['name']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testRenameTable()
|
|
|
|
{
|
2009-11-03 19:56:05 +03:00
|
|
|
$this->_sm->tryMethod('DropTable', 'list_tables_test');
|
|
|
|
$this->_sm->tryMethod('DropTable', 'list_tables_test_new_name');
|
2009-05-30 06:27:50 +04:00
|
|
|
|
|
|
|
$this->createTestTable('list_tables_test');
|
|
|
|
$this->_sm->renameTable('list_tables_test', 'list_tables_test_new_name');
|
|
|
|
|
|
|
|
$tables = $this->_sm->listTables();
|
|
|
|
$this->assertEquals(true, in_array('LIST_TABLES_TEST_NEW_NAME', $tables));
|
|
|
|
}
|
|
|
|
}
|