1
0
mirror of synced 2024-12-16 16:16:04 +03:00
doctrine2/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php

78 lines
2.1 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 OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
public function setUp()
{
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-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()
{
$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()
{
$this->_sm->tryMethod('DropTable', 'list_tables_test');
$this->_sm->tryMethod('DropTable', 'list_tables_test_new_name');
$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));
}
}