You are here

function CrudTest::testBundleMapping in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rdf/src/Tests/CrudTest.php \Drupal\rdf\Tests\CrudTest::testBundleMapping()

Test the handling of bundle mappings.

File

core/modules/rdf/src/Tests/CrudTest.php, line 63
Contains \Drupal\rdf\Tests\CrudTest.

Class

CrudTest
Tests the RDF mapping CRUD functions.

Namespace

Drupal\rdf\Tests

Code

function testBundleMapping() {

  // Test that the bundle mapping can be saved.
  $types = array(
    'sioc:Post',
    'foaf:Document',
  );
  rdf_get_mapping($this->entityType, $this->bundle)
    ->setBundleMapping(array(
    '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 = array(
    'schema:BlogPosting',
  );
  rdf_get_mapping($this->entityType, $this->bundle)
    ->setBundleMapping(array(
    'types' => $types,
  ))
    ->save();
  $bundle_mapping = rdf_get_mapping($this->entityType, $this->bundle)
    ->getBundleMapping();
  $this
    ->assertEqual($types, $bundle_mapping['types'], 'Bundle mapping updated.');
}