function BiblioNodeCreationTestCase::testBiblioNodeCreation in Bibliography Module 7.2
Same name and namespace in other branches
- 7 tests/BiblioNodeCreationTestCase.test \BiblioNodeCreationTestCase::testBiblioNodeCreation()
Create a biblio node and verify its consistency in the database.
File
- tests/
biblio.test, line 109
Class
Code
function testBiblioNodeCreation() {
// Create a node.
$edit = array();
$edit["biblio_type"] = '101';
$this
->drupalPost('node/add/biblio', $edit, t('Next'));
// Check that the next step of the form appears.
$this
->assertOptionSelected('edit-biblio-type', '101');
$this
->assertFieldById('edit-title');
$this
->assertFieldById('edit-biblio-year');
$edit = array(
'title' => $this
->randomString(32),
'biblio_year' => '2009',
'biblio_contributors[0][name]' => 'Kevin Brown',
'biblio_contributors[1][name]' => 'Martin Clark',
'biblio_contributors[2][name]' => 'George Wei',
'biblio_keywords' => 'architecture, building, wood',
);
$this
->drupalPost(NULL, $edit, t('Save'));
// Check that the Basic page has been created.
$this
->assertRaw(t('!post %title has been created.', array(
'!post' => 'Biblio',
'%title' => $edit["title"],
)), t('Biblio entry created.'));
$this
->assertText(t('architecture, building, wood', array(
'!post' => 'Biblio',
'%title' => $edit["title"],
)), t('Keywords are present on the biblio node.'));
// Check that the node exists in the database.
$node = $this
->drupalGetNodeByTitle($edit['title']);
$this
->assertTrue($node, t('Node found in database.'));
}