You are here

public function DefaultTableMappingTest::testGetColumnNames in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 211
Contains \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest.

Class

DefaultTableMappingTest
@coversDefaultClass \Drupal\Core\Entity\Sql\DefaultTableMapping @group Entity

Namespace

Drupal\Tests\Core\Entity\Sql

Code

public function testGetColumnNames() {
  $definitions['test'] = $this
    ->setUpDefinition('test', []);
  $table_mapping = new DefaultTableMapping($this->entityType, $definitions);
  $expected = [];
  $this
    ->assertSame($expected, $table_mapping
    ->getColumnNames('test'));
  $definitions['test'] = $this
    ->setUpDefinition('test', [
    'value',
  ]);
  $table_mapping = new DefaultTableMapping($this->entityType, $definitions);
  $expected = [
    'value' => 'test',
  ];
  $this
    ->assertSame($expected, $table_mapping
    ->getColumnNames('test'));
  $definitions['test'] = $this
    ->setUpDefinition('test', [
    'value',
    'format',
  ]);
  $table_mapping = new DefaultTableMapping($this->entityType, $definitions);
  $expected = [
    'value' => 'test__value',
    'format' => 'test__format',
  ];
  $this
    ->assertSame($expected, $table_mapping
    ->getColumnNames('test'));
}