You are here

public function LibraryWebTestCase::testNodeCreation in Library 7

File

tests/library.unit.test, line 58

Class

LibraryWebTestCase

Code

public function testNodeCreation() {
  $this
    ->assertTrue(db_table_exists('library'), 'Table exists');
  $result_node = $this
    ->drupalCreateNode($this->dummyNode);
  $this
    ->assertTrue($result_node, 'Node successfully created');
  $actual_node = node_load($result_node->nid);
  $this
    ->assertNotNull($actual_node->library_items[0]['id'], 'Library item has an ID.');
  $this
    ->assertNotNull($actual_node->library_items[0]['barcode'], 'Library item has a barcode.');
  $this
    ->assertTrue(library_load($actual_node->library_items[0]['id']), 'Item on node successfully loaded');
  $this
    ->drupalGet('node/' . $actual_node->nid);
  $this
    ->assertText($this->dummyNode['title']);
  $this
    ->assertText($this->dummyNode['library_items'][0]['barcode']);
}