function EntityRevisionParamConverterTest::providerTestConvert

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityRevisionParamConverterTest::providerTestConvert()
  2. 8.9.x core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityRevisionParamConverterTest::providerTestConvert()
  3. 11.x core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityRevisionParamConverterTest::providerTestConvert()

Provides test data for testConvert.

File

core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php, line 91

Class

EntityRevisionParamConverterTest
@coversDefaultClass \Drupal\Core\ParamConverter\EntityRevisionParamConverter[[api-linebreak]] @group entity

Namespace

Drupal\Tests\Core\ParamConverter

Code

public static function providerTestConvert() {
  $data = [];
  // Existing entity type.
  $data[] = [
    'valid_id',
    [
      'type' => 'entity_revision:entity_test',
    ],
    [
      'test_revision' => 'valid_id',
    ],
    (object) [
      'revision_id' => 'valid_id',
    ],
  ];
  // Invalid ID.
  $data[] = [
    'invalid_id',
    [
      'type' => 'entity_revision:entity_test',
    ],
    [
      'test_revision' => 'invalid_id',
    ],
    NULL,
  ];
  // Entity type placeholder.
  $data[] = [
    'valid_id',
    [
      'type' => 'entity_revision:{entity_type}',
    ],
    [
      'test_revision' => 'valid_id',
      'entity_type' => 'entity_test',
    ],
    (object) [
      'revision_id' => 'valid_id',
    ],
  ];
  return $data;
}

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