'Journal functionality', 'description' => 'Tests Journal module functionality.', 'group' => 'Journal', ); } function setUp() { parent::setUp(array('block', 'journal')); $this->web_user = $this->drupalCreateUser(array('administer blocks', 'access journal')); $this->drupalLogin($this->web_user); // Enable main system block for content region. // @see http://drupal.org/node/913086 $default_theme = variable_get('theme_default', 'bartik'); db_merge('block') ->key(array( 'theme' => $default_theme, 'module' => 'system', 'delta' => 'main', )) ->fields(array( 'status' => 1, 'region' => 'content', 'pages' => '', )) ->execute(); } /** * Test a basic journal entry. */ function testJournalAddEntry() { // Add a new block. $title = $this->randomName(8); $description = $this->randomName(8); $journal_entry = $this->randomName(8); $edit = array( 'info' => $description, 'title' => $title, 'body[value]' => $this->randomName(8), 'journal_entry' => $journal_entry, ); $this->drupalPost('admin/structure/block/add', $edit, t('Save block')); // Verify the journal entry was recorded. $this->drupalGet('admin/reports/journal'); $this->assertText($journal_entry, t('New entry appears in journal.')); $this->assertText('admin/structure/block/add', t('Location of new entry appears in journal.')); } /** * Test a journal entry for forms using '#tree = TRUE' on root level. */ function testJournalAddEntryWhereTreeTrue() { $journal_entry = $this->randomName(8); $edit = array( 'journal_entry' => $journal_entry, ); $this->drupalPost('admin/structure/block', $edit, 'Save blocks'); // Verify the journal entry was recorded. $this->drupalGet('admin/reports/journal'); $this->assertText($journal_entry, t('Entry submitted in form using #tree appears in journal.')); } }