function NonPublicSchemaTest::testTable
Same name in other branches
- 10 core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php \Drupal\Tests\pgsql\Kernel\pgsql\NonPublicSchemaTest::testTable()
@covers ::renameTable @covers ::tableExists @covers ::findTables @covers ::dropTable
File
-
core/
modules/ pgsql/ tests/ src/ Kernel/ pgsql/ NonPublicSchemaTest.php, line 346
Class
- NonPublicSchemaTest
- Tests schema API for non-public schema for the PostgreSQL driver.
Namespace
Drupal\Tests\pgsql\Kernel\pgsqlCode
public function testTable() : void {
$this->testingFakeConnection
->schema()
->renameTable('faking_table', 'new_faking_table');
$tables = $this->testingFakeConnection
->schema()
->findTables('%');
$result = $this->testingFakeConnection
->query("SELECT * FROM information_schema.tables WHERE table_schema = 'testing_fake'")
->fetchAll();
$this->assertFalse($this->testingFakeConnection
->schema()
->tableExists('faking_table'));
$this->assertTrue($this->testingFakeConnection
->schema()
->tableExists('new_faking_table'));
$this->assertEquals($this->testingFakeConnection
->getPrefix() . 'new_faking_table', $result[0]->table_name);
$this->assertEquals('testing_fake', $result[0]->table_schema);
sort($tables);
$this->assertEquals([
'new_faking_table',
], $tables);
$this->testingFakeConnection
->schema()
->dropTable('new_faking_table');
$this->assertFalse($this->testingFakeConnection
->schema()
->tableExists('new_faking_table'));
$this->assertCount(0, $this->testingFakeConnection
->query("SELECT * FROM information_schema.tables WHERE table_schema = 'testing_fake'")
->fetchAll());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.