function NonPublicSchemaTest::testExtensionExists
Same name in other branches
- 10 core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php \Drupal\Tests\pgsql\Kernel\pgsql\NonPublicSchemaTest::testExtensionExists()
@covers ::extensionExists @covers ::tableExists
File
-
core/
modules/ pgsql/ tests/ src/ Kernel/ pgsql/ NonPublicSchemaTest.php, line 113
Class
- NonPublicSchemaTest
- Tests schema API for non-public schema for the PostgreSQL driver.
Namespace
Drupal\Tests\pgsql\Kernel\pgsqlCode
public function testExtensionExists() : void {
// Check if PG_trgm extension is present.
$this->assertTrue($this->testingFakeConnection
->schema()
->extensionExists('pg_trgm'));
// Asserting that the Schema testing_fake exist in the database.
$this->assertCount(1, \Drupal::database()->query("SELECT * FROM pg_catalog.pg_namespace WHERE nspname = 'testing_fake'")
->fetchAll());
$this->assertTrue($this->testingFakeConnection
->schema()
->tableExists('faking_table'));
// Hardcoded assertion that we created the table in the non-public schema.
$this->assertCount(1, $this->testingFakeConnection
->query("SELECT * FROM pg_tables WHERE schemaname = 'testing_fake' AND tablename = :prefixedTable", [
':prefixedTable' => $this->testingFakeConnection
->getPrefix() . "faking_table",
])
->fetchAll());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.