public function DefaultTableMappingTest::testGetTableNames in Zircon Profile 8.0
Same name and namespace in other branches
- 8 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 44 - Contains \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest.
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 DefaultTableMapping($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());
}