You are here

public function CrudTest::testBundleMapping in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/rdf/tests/src/Kernel/CrudTest.php \Drupal\Tests\rdf\Kernel\CrudTest::testBundleMapping()
  2. 10 core/modules/rdf/tests/src/Kernel/CrudTest.php \Drupal\Tests\rdf\Kernel\CrudTest::testBundleMapping()

Test the handling of bundle mappings.

File

core/modules/rdf/tests/src/Kernel/CrudTest.php, line 58

Class

CrudTest
Tests the RDF mapping CRUD functions.

Namespace

Drupal\Tests\rdf\Kernel

Code

public function testBundleMapping() {

  // Test that the bundle mapping can be saved.
  $types = [
    'sioc:Post',
    'foaf:Document',
  ];
  rdf_get_mapping($this->entityType, $this->bundle)
    ->setBundleMapping([
    'types' => $types,
  ])
    ->save();
  $bundle_mapping = rdf_get_mapping($this->entityType, $this->bundle)
    ->getBundleMapping();
  $this
    ->assertEqual($types, $bundle_mapping['types'], 'Bundle mapping saved.');

  // Test that the bundle mapping can be edited.
  $types = [
    'schema:BlogPosting',
  ];
  rdf_get_mapping($this->entityType, $this->bundle)
    ->setBundleMapping([
    'types' => $types,
  ])
    ->save();
  $bundle_mapping = rdf_get_mapping($this->entityType, $this->bundle)
    ->getBundleMapping();
  $this
    ->assertEqual($types, $bundle_mapping['types'], 'Bundle mapping updated.');
}