RdfMappingHookTestCase::testMapping

7 rdf.test RdfMappingHookTestCase::testMapping()
8 rdf.test RdfMappingHookTestCase::testMapping()

Test that hook_rdf_mapping() correctly returns and processes mapping.

File

modules/rdf/rdf.test, line 24
Tests for rdf.module.

Code

function testMapping() {
  // Test that the mapping is returned correctly by the hook.
  $mapping = rdf_mapping_load('test_entity', 'test_bundle');
  $this->assertIdentical($mapping['rdftype'], array('sioc:Post'), t('Mapping for rdftype is sioc:Post.'));
  $this->assertIdentical($mapping['title'], array('predicates' => array('dc:title')), t('Mapping for title is dc:title.'));
  $this->assertIdentical($mapping['created'], array(
    'predicates' => array('dc:created'), 
    'datatype' => 'xsd:dateTime', 
    'callback' => 'date_iso8601',
  ), t('Mapping for created is dc:created with datatype xsd:dateTime and callback date_iso8601.'));
  $this->assertIdentical($mapping['uid'], array('predicates' => array('sioc:has_creator', 'dc:creator'), 'type' => 'rel'), t('Mapping for uid is sioc:has_creator and dc:creator, and type is rel.'));

  $mapping = rdf_mapping_load('test_entity', 'test_bundle_no_mapping');
  $this->assertEqual($mapping, array(), t('Empty array returned when an entity type, bundle pair has no mapping.'));
}
Login or register to post comments