function CrudTest::testBundleMapping

Same name and namespace in other branches
  1. 9 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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.