function ForumIndexTest::testForumIndexIndex
Tests there's a primary key on the forum_index table.
File
- 
              core/
modules/ forum/ tests/ src/ Kernel/ ForumIndexTest.php, line 46  
Class
- ForumIndexTest
 - Defines a class for testing the forum_index table.
 
Namespace
Drupal\Tests\forum\KernelCode
public function testForumIndexIndex() : void {
  $schema = \Drupal::database()->schema();
  $this->assertTrue($schema->tableExists('forum_index'));
  // We can't reliably call ::indexExists for each database driver as sqlite
  // doesn't have named indexes for primary keys like mysql (PRIMARY) and
  // pgsql (pkey).
  $find_primary_key_columns = new \ReflectionMethod(get_class($schema), 'findPrimaryKeyColumns');
  $this->assertEquals([
    'nid',
    'tid',
  ], $find_primary_key_columns->invoke($schema, 'forum_index'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.