public function ResourceTypeRepositoryTest::testCaching in Drupal 8
Same name and namespace in other branches
- 9 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 108
Class
- ResourceTypeRepositoryTest
- @coversDefaultClass \Drupal\jsonapi\ResourceType\ResourceTypeRepository @group jsonapi
Namespace
Drupal\Tests\jsonapi\Kernel\ResourceTypeCode
public function testCaching() {
$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',
])
->save();
$this
->assertCount(4, $this->resourceTypeRepository
->get('node', 'article')
->getRelatableResourceTypesByField('field_relationship'));
}