function ResourceTypeRepositoryTest::testCaching
Same name and namespace in other branches
- 9 core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php \Drupal\Tests\jsonapi\Kernel\ResourceType\ResourceTypeRepositoryTest::testCaching()
- 8.9.x core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php \Drupal\Tests\jsonapi\Kernel\ResourceType\ResourceTypeRepositoryTest::testCaching()
- 10 core/modules/jsonapi/tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php \Drupal\Tests\jsonapi\Kernel\ResourceType\ResourceTypeRepositoryTest::testCaching()
Ensures that the ResourceTypeRepository's cache does not become stale.
File
-
core/
modules/ jsonapi/ tests/ src/ Kernel/ ResourceType/ ResourceTypeRepositoryTest.php, line 114
Class
- ResourceTypeRepositoryTest
- @coversDefaultClass <a href="/api/drupal/core%21modules%21jsonapi%21src%21ResourceType%21ResourceTypeRepository.php/class/ResourceTypeRepository/11.x" title="Provides a repository of all JSON:API resource types." class="local">\Drupal\jsonapi\ResourceType\ResourceTypeRepository</a> @group jsonapi @group #slow
Namespace
Drupal\Tests\jsonapi\Kernel\ResourceTypeCode
public function testCaching() : void {
$this->assertEmpty($this->resourceTypeRepository
->get('node', 'article')
->getRelatableResourceTypesByField('field_relationship'));
$this->createEntityReferenceField('node', 'article', 'field_relationship', 'Related entity', 'node');
$this->assertCount(3, $this->resourceTypeRepository
->get('node', 'article')
->getRelatableResourceTypesByField('field_relationship'));
NodeType::create([
'type' => 'camelids',
'name' => 'Camelids',
])->save();
$this->assertCount(4, $this->resourceTypeRepository
->get('node', 'article')
->getRelatableResourceTypesByField('field_relationship'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.