function DefaultTableMappingTest::providerTestGetDedicatedTableName

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::providerTestGetDedicatedTableName()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php \Drupal\Tests\Core\Entity\Sql\DefaultTableMappingTest::providerTestGetDedicatedTableName()
  3. 11.x 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 499

Class

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

Namespace

Drupal\Tests\Core\Entity\Sql

Code

public static 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_all_forty_three_characters',
            'field_name' => 'short_field_name',
            'prefix' => '',
        ],
        'long_entity_type_all_forty_three__d52fc85045',
        'long_entity_type_all_forty_three_r__d52fc85045',
    ];
    $data['long entity type; long field name; no prefix'] = [
        [
            'entity_type_id' => 'long_entity_type_all_forty_three_characters',
            'field_name' => 'long_field_name_using_forty_two_characters',
            'prefix' => '',
        ],
        'long_entity_type_all_forty_three__7f5744e4fd',
        'long_entity_type_all_forty_three_r__7f5744e4fd',
    ];
    $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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.