function DefaultTableMappingTest::testGetColumnNames
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::testGetColumnNames()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::testGetColumnNames()
- 10 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::testGetColumnNames()
Tests DefaultTableMapping::getColumnNames().
@covers ::__construct @covers ::getColumnNames
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ Sql/ DefaultTableMappingTest.php, line 209
Class
- DefaultTableMappingTest
- @coversDefaultClass \Drupal\Core\Entity\Sql\DefaultTableMapping @group Entity
Namespace
Drupal\Tests\Core\Entity\SqlCode
public function testGetColumnNames() : void {
$definitions['test'] = $this->setUpDefinition('test', []);
$table_mapping = new TestDefaultTableMapping($this->entityType, $definitions);
$expected = [];
$this->assertSame($expected, $table_mapping->getColumnNames('test'));
$definitions['test'] = $this->setUpDefinition('test', [
'value',
]);
$table_mapping = new TestDefaultTableMapping($this->entityType, $definitions);
$expected = [
'value' => 'test',
];
$this->assertSame($expected, $table_mapping->getColumnNames('test'));
$definitions['test'] = $this->setUpDefinition('test', [
'value',
'format',
]);
$table_mapping = new TestDefaultTableMapping($this->entityType, $definitions);
$expected = [
'value' => 'test__value',
'format' => 'test__format',
];
$this->assertSame($expected, $table_mapping->getColumnNames('test'));
$definitions['test'] = $this->setUpDefinition('test', [
'value',
]);
// Set custom storage.
$definitions['test']->expects($this->any())
->method('hasCustomStorage')
->wilLReturn(TRUE);
$table_mapping = new TestDefaultTableMapping($this->entityType, $definitions);
// Should return empty for column names.
$this->assertSame([], $table_mapping->getColumnNames('test'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.