function DefaultTableMappingTest::providerTestGetDedicatedTableName

Same name and namespace in other branches
  1. 8.9.x 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()
  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 497

Class

DefaultTableMappingTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21Sql%21DefaultTableMapping.php/class/DefaultTableMapping/9" title="Defines a default table mapping class." class="local">\Drupal\Core\Entity\Sql\DefaultTableMapping</a> @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;
}

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