You are here

public function ResourceTypeRepositoryTest::testGet in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php \Drupal\Tests\jsonapi\Kernel\ResourceType\ResourceTypeRepositoryTest::testGet()

@covers ::get @dataProvider getProvider

File

tests/src/Kernel/ResourceType/ResourceTypeRepositoryTest.php, line 76

Class

ResourceTypeRepositoryTest
@coversDefaultClass \Drupal\jsonapi\ResourceType\ResourceTypeRepository @group jsonapi @group legacy

Namespace

Drupal\Tests\jsonapi\Kernel\ResourceType

Code

public function testGet($entity_type_id, $bundle, $entity_class) {

  // Make sure that there are resources being created.
  $resource_type = $this->resourceTypeRepository
    ->get($entity_type_id, $bundle);
  $this
    ->assertInstanceOf(ResourceType::class, $resource_type);
  $this
    ->assertSame($entity_class, $resource_type
    ->getDeserializationTargetClass());
  $this
    ->assertSame($entity_type_id, $resource_type
    ->getEntityTypeId());
  $this
    ->assertSame($bundle, $resource_type
    ->getBundle());
  $this
    ->assertSame($entity_type_id . '--' . $bundle, $resource_type
    ->getTypeName());
}