You are here

function RdfxFeaturesIntegrationTestCase::testFeaturesEnable in RDF Extensions 7.2

Enables a feature and ensures the RDF mappings take effect.

File

./rdfx.test, line 156

Class

RdfxFeaturesIntegrationTestCase
Tests the RDF features integration.

Code

function testFeaturesEnable() {

  // Checks initial Article RDF mappings.
  $mappings = rdf_mapping_load('node', 'article');
  $this
    ->assertTrue($mappings['rdftype'] == array(
    'sioc:Item',
    'foaf:Document',
  ), t('Initial RDF type set properly.'));
  $this
    ->assertTrue($mappings['title']['predicates'] == array(
    'dc:title',
  ), t('Initial property for title set properly.'));
  $this
    ->assertTrue($mappings['field_tags']['predicates'] == array(
    'dc:subject',
  ), t('Initial property for tags field set properly.'));

  // Checks if mappings defined in the feature have been saved.
  module_enable(array(
    'rdfx_test',
  ));
  features_revert(array(
    'rdfx_test' => array(
      'rdf_mappings',
    ),
  ));
  $mappings = rdf_mapping_load('node', 'article');
  $this
    ->assertTrue($mappings['rdftype'] == array(
    'sioc:Post',
  ), t('sioc:num_replies value found in ARC2 index.'));
  $this
    ->assertTrue($mappings['title']['predicates'] == array(
    'rdfs:label',
  ), t('sioc:num_replies value found in ARC2 index.'));
  $this
    ->assertTrue($mappings['field_tags']['predicates'] == array(
    'dc:subject',
  ), t('Initial property for tags field set properly.'));
}