function ResourceTypeRepositoryTest::testMappingNameConflictCheck
Same name in other branches
- 8.9.x core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php \Drupal\Tests\jsonapi\Kernel\ResourceType\ResourceTypeRepositoryTest::testMappingNameConflictCheck()
- 10 core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php \Drupal\Tests\jsonapi\Kernel\ResourceType\ResourceTypeRepositoryTest::testMappingNameConflictCheck()
- 11.x core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php \Drupal\Tests\jsonapi\Kernel\ResourceType\ResourceTypeRepositoryTest::testMappingNameConflictCheck()
Ensures that a naming conflict in mapping causes an exception to be thrown.
@covers ::getFields @dataProvider getFieldsProvider
File
-
core/
modules/ jsonapi/ tests/ src/ Kernel/ ResourceType/ ResourceTypeRepositoryTest.php, line 122
Class
- ResourceTypeRepositoryTest
- @coversDefaultClass \Drupal\jsonapi\ResourceType\ResourceTypeRepository @group jsonapi
Namespace
Drupal\Tests\jsonapi\Kernel\ResourceTypeCode
public function testMappingNameConflictCheck($field_name_list) {
$entity_type = \Drupal::entityTypeManager()->getDefinition('node');
$bundle = 'article';
$reflection_class = new \ReflectionClass($this->resourceTypeRepository);
$reflection_method = $reflection_class->getMethod('getFields');
$reflection_method->setAccessible(TRUE);
$this->expectException(\LogicException::class);
$this->expectExceptionMessage("The generated alias '{$field_name_list[1]}' for field name '{$field_name_list[0]}' conflicts with an existing field. Please report this in the JSON:API issue queue!");
$reflection_method->invokeArgs($this->resourceTypeRepository, [
$field_name_list,
$entity_type,
$bundle,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.