public function EntityConverterTest::providerTestConvert in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::providerTestConvert()
Provides test data for testConvert
File
- core/
tests/ Drupal/ Tests/ Core/ ParamConverter/ EntityConverterTest.php, line 308
Class
- EntityConverterTest
- @coversDefaultClass \Drupal\Core\ParamConverter\EntityConverter @group ParamConverter @group Entity
Namespace
Drupal\Tests\Core\ParamConverterCode
public function providerTestConvert() {
$data = [];
// Existing entity type.
$data[] = [
'valid_id',
[
'type' => 'entity:entity_test',
],
[
'foo' => 'valid_id',
],
(object) [
'id' => 'valid_id',
],
];
// Invalid ID.
$data[] = [
'invalid_id',
[
'type' => 'entity:entity_test',
],
[
'foo' => 'invalid_id',
],
NULL,
];
// Entity type placeholder.
$data[] = [
'valid_id',
[
'type' => 'entity:{entity_type}',
],
[
'foo' => 'valid_id',
'entity_type' => 'entity_test',
],
(object) [
'id' => 'valid_id',
],
];
return $data;
}