t('Better formats tests'), 'description' => t('Test some of the BetterFormats features.'), 'group' => t('Better Formats'), ); } /** * Implementation of setUp(). */ function setUp() { parent::setUp('better_formats'); } /** * Test various behaviors for anonymous users. */ function testBetterFormatsFunctionalTest() { // Create a user with permission to view the actions administration pages. $admin = $this->drupalCreateUser(array('administer permissions', 'administer filters')); $this->drupalLogin($admin); // Hide the format tips link. $this->setPermission('anonymous user', array('show more format tips link' => FALSE, 'access comments' => TRUE, 'access content' => TRUE, 'post comments' => TRUE, 'post comments without approval' => TRUE)); $this->node = $this->drupalCreateNode(array('type' => 'story', 'promote' => 1, 'comment' => 2)); $this->drupalLogout(); $this->drupalGet('comment/reply/' . $this->node->nid); $this->assertNoText('More information about formatting options.', 'Show more format tips link removed.'); // Default for comments, hiding format selection on comments. $this->drupalLogin($admin); // Let anon use full html - it's crazy, but it's just simpletest $edit = array(); $edit['roles[1]'] = TRUE; $this->drupalPost('admin/settings/filters/2', $edit, t('Save configuration')); // Set full html as default for anon on comments - again, crazy, but... $edit = array(); $edit['comment-1[format]'] = 2; $this->drupalPost('admin/settings/filters/defaults', $edit, t('Save defaults')); $this->setPermission('anonymous user', array('show format selection for comments' => FALSE, 'create page content' => TRUE)); $this->drupalLogout(); // Now, do we see the signature for Full HTML on the comment page? $this->drupalGet('comment/reply/' . $this->node->nid); $this->assertNoText('Allowed HTML tags:', 'Filter tips removed on comments.'); $this->assertText('Web page addresses and e-mail addresses turn into links automatically.', 'Filter tips removed on comments.'); // And do we see the Filtered HTML on a node page? $this->drupalGet('node/add/page'); $this->assertText('Allowed HTML tags:', 'Filter tips still on a page.'); // Collapsible format selection collapsed by default. $this->drupalLogin($admin); $this->setPermission('anonymous user', array('show format selection for comments' => TRUE)); $this->drupalLogout(); $this->drupalGet('comment/reply/' . $this->node->nid); $this->assertText('Filtered HTML', 'Allow format selection on comments.'); $this->assertRaw('