public function DefaultTableMappingTest::testGetTableNames in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::testGetTableNames()
Tests DefaultTableMapping::getTableNames().
@covers ::getTableNames
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ Sql/ DefaultTableMappingTest.php, line 41
Class
- DefaultTableMappingTest
- @coversDefaultClass \Drupal\Core\Entity\Sql\DefaultTableMapping @group Entity
Namespace
Drupal\Tests\Core\Entity\SqlCode
public function testGetTableNames() {
// The storage definitions are only used in getColumnNames() so we do not
// need to provide any here.
$table_mapping = new TestDefaultTableMapping($this->entityType, []);
$this
->assertSame([], $table_mapping
->getTableNames());
$table_mapping
->setFieldNames('foo', []);
$this
->assertSame([
'foo',
], $table_mapping
->getTableNames());
$table_mapping
->setFieldNames('bar', []);
$this
->assertSame([
'foo',
'bar',
], $table_mapping
->getTableNames());
$table_mapping
->setExtraColumns('baz', []);
$this
->assertSame([
'foo',
'bar',
'baz',
], $table_mapping
->getTableNames());
// Test that table names are not duplicated.
$table_mapping
->setExtraColumns('foo', []);
$this
->assertSame([
'foo',
'bar',
'baz',
], $table_mapping
->getTableNames());
}