You are here

protected function RdfUiContentMappingTest::testNodeTypeEditing in Schema.org configuration tool (RDF UI) 8

Tests editing a node type using the UI.

File

src/Tests/RdfUiContentMappingTest.php, line 62

Class

RdfUiContentMappingTest
Tests related to adding and editing RDF mappings for node types.

Namespace

Drupal\rdfui\Tests

Code

protected function testNodeTypeEditing() {
  $web_user = $this
    ->drupalCreateUser(array(
    'bypass node access',
    'administer content types',
    'administer node fields',
  ));
  $this
    ->drupalLogin($web_user);
  $edit_type = 'admin/structure/types/manage/page';

  // Verify that title and body fields are displayed.
  $this
    ->drupalGet($edit_type);
  $this
    ->assertRaw('Schema.org Mappings', 'Schema.Org tab found.');
  $this
    ->assertRaw('Schema.org Type', 'Schema.Org tab content found.');

  // Change the rdf mapping.
  $edit = array(
    'types' => 'schema:Person',
  );
  $this
    ->drupalPostForm($edit_type, $edit, t('Save content type'));
  $mapping = rdf_get_mapping('node', 'page');
  $type = $mapping
    ->getBundleMapping();
  $this
    ->assertEqual($type['types'][0], $edit['types'], 'Content mapping saved correctly.');
}