t('Journal module functionality'), // 'description' should be one or more complete sentences // explaining the test. 'description' => t('Test the journal module functionality.'), // 'group' should be a logical grouping of test cases, like a category. // Suggestion: Use the name of the module to be tested. 'group' => t('Journal'), ); } function setUp() { parent::setUp('journal'); $user = $this->drupalCreateUser(array ( 0 => 'administer blocks', 1 => 'access journal', )); $this->drupalLogin($user); } /** TODO: if testJournal479358 succeeded we need to put the block back */ function tearDown() { parent::tearDown(); #foreach ($block as $blocks) { #} } /** Unit tests */ /** Functional tests */ /** * Tests a basic journal entry */ function testJournalAddJournal() { /** Add a new block */ $title = $this->randomName(8); $description = $this->randomName(8); $blocks[] = $title; $journal_entry = $this->randomName(8); $edit = array ( 'info' => $description, 'title' => $title, 'body' => $this->randomName(8), 'pages' => '', 'journal_entry' => $journal_entry, ); $this->drupalPost('admin/build/block/add', $edit, 'Save block'); $this->assertText($description, t('Verify that the block was added')); $this->drupalGet(url('admin/reports/journal', array("absolute" => TRUE))); $handle = fopen('/tmp/journaltest.html', 'w'); fwrite($handle, $this->drupalGetContent()); fclose($handle); $this->assertText($journal_entry, t('Verify that the journal entry is listed')); } /** * Test of a bug that would not allow journal to add entries under certain circumstances * * Issue: http://drupal.org/node/479358 * Log into the site * enable a module from admin/build/blocks, adding a journal entry * journal entry should be in journal log (admin/reports/journal) */ function testJournal479358() { /** Add a new block */ $title = $this->randomName(8); $blocks[] = $title; $journal_entry = $this->randomName(8); $edit = array ( 'info' => $this->randomName(8), 'title' => $title, 'body' => $this->randomName(8), 'pages' => '', 'journal_entry' => $journal_entry, ); $this->drupalPost('admin/build/block/add', $edit, 'Save block'); /** TODO: e need to get the form values for the Journal entries form */ /** Position the new block addinga journal entry */ $journal_entry = $this->randomName(8); $edit = array ( 'journal_backlog[region]' => 'right', #'journal_backlog[theme]' => 'garland', 'journal_backlog[weight]' => '-6', 'journal[journal_entry]' => $journal_entry, ); $this->drupalPost('admin/build/block', $edit, 'Save blocks'); $this->drupalGet(url('admin/reports/journal', array("absolute" => TRUE))); $this->assertText($journal_entry, t('Verify that the journal entry is listed')); /** delete the block */ #db_query("DELETE from {blocks} where title = '%s'", $title); /** delete the journal entries */ } } ?>