You are here

public function DefaultTableMappingTest::providerTestGetFieldColumnName in Zircon Profile 8.0

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

Provides test data for testGetFieldColumnName().

Return value

array[] An nested array where each inner array has the following values: test field name, base field status, list of field columns, name of the column to be retrieved, expected result, whether an exception is expected.

File

core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php, line 320
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 providerTestGetFieldColumnName() {
  $data = [];

  // Base field with single column.
  $data[] = [
    TRUE,
    [
      'foo',
    ],
    'foo',
    'test',
  ];

  // Base field with multiple columns.
  $data[] = [
    TRUE,
    [
      'foo',
      'bar',
    ],
    'foo',
    'test__foo',
  ];
  $data[] = [
    TRUE,
    [
      'foo',
      'bar',
    ],
    'bar',
    'test__bar',
  ];

  // Bundle field with single column.
  $data[] = [
    FALSE,
    [
      'foo',
    ],
    'foo',
    'test_foo',
  ];

  // Bundle field with multiple columns.
  $data[] = [
    FALSE,
    [
      'foo',
      'bar',
    ],
    'foo',
    'test_foo',
  ];
  $data[] = [
    FALSE,
    [
      'foo',
      'bar',
    ],
    'bar',
    'test_bar',
  ];

  // Bundle field with reserved column.
  $data[] = [
    FALSE,
    [
      'foo',
      'bar',
    ],
    'deleted',
    'deleted',
  ];
  return $data;
}