You are here

public function DefaultTableMappingTest::providerTestGetDedicatedTableName in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::providerTestGetDedicatedTableName()
  2. 10 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::providerTestGetDedicatedTableName()

Provides test data for testGetDedicatedTableName().

Return value

array[] A nested array where each inner array has the following values: an array consisting of the entity type ID, field name and a table prefix, followed by the expected data table name and the revision table name.

File

core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php, line 494

Class

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

Namespace

Drupal\Tests\Core\Entity\Sql

Code

public function providerTestGetDedicatedTableName() {
  $data = [];
  $data['short entity type; short field name; no prefix'] = [
    [
      'entity_type_id' => 'short_entity_type',
      'field_name' => 'short_field_name',
      'prefix' => '',
    ],
    'short_entity_type__short_field_name',
    'short_entity_type_revision__short_field_name',
  ];
  $data['short entity type; long field name; no prefix'] = [
    [
      'entity_type_id' => 'short_entity_type',
      'field_name' => 'long_field_name_abcdefghijklmnopqrstuvwxyz',
      'prefix' => '',
    ],
    'short_entity_type__28a01c7777',
    'short_entity_type_r__28a01c7777',
  ];
  $data['long entity type; short field name; no prefix'] = [
    [
      'entity_type_id' => 'long_entity_type_abcdefghijklmnopqrstuvwxyz',
      'field_name' => 'short_field_name',
      'prefix' => '',
    ],
    'long_entity_type_abcdefghijklmno__a526e4e042',
    'long_entity_type_abcdefghijklmno_r__a526e4e042',
  ];
  $data['long entity type; long field name; no prefix'] = [
    [
      'entity_type_id' => 'long_entity_type_abcdefghijklmnopqrstuvwxyz',
      'field_name' => 'long_field_name_abcdefghijklmnopqrstuvwxyz',
      'prefix' => '',
    ],
    'long_entity_type_abcdefghijklmno__7705d52d75',
    'long_entity_type_abcdefghijklmno_r__7705d52d75',
  ];
  $data['short entity type; short field name; with prefix'] = [
    [
      'entity_type_id' => 'short_entity_type',
      'field_name' => 'short_field_name',
      'prefix' => 'prefix_',
    ],
    'prefix_short_entity_type__short_field_name',
    'prefix_short_entity_type_r__a133cc765a',
  ];
  $data['short entity type; long field name; with prefix'] = [
    [
      'entity_type_id' => 'short_entity_type',
      'field_name' => 'long_field_name_abcdefghijklmnopqrstuvwxyz',
      'prefix' => 'prefix_',
    ],
    'prefix_short_entity_type__28a01c7777',
    'prefix_short_entity_type_r__28a01c7777',
  ];
  $data['long entity type; short field name; with prefix'] = [
    [
      'entity_type_id' => 'long_entity_type_abcdefghijklmnopqrstuvwxyz',
      'field_name' => 'short_field_name',
      'prefix' => 'prefix_',
    ],
    'prefix___a526e4e042',
    'prefix__r__a526e4e042',
  ];
  $data['long entity type; long field name; with prefix'] = [
    [
      'entity_type_id' => 'long_entity_type_abcdefghijklmnopqrstuvwxyz',
      'field_name' => 'long_field_name_abcdefghijklmnopqrstuvwxyz',
      'prefix' => 'prefix_',
    ],
    'prefix___7705d52d75',
    'prefix__r__7705d52d75',
  ];
  return $data;
}