You are here

public function PatternsToolbarTestCase::test_toolbar in Patterns 7.2

Same name and namespace in other branches
  1. 7 tests/toolbar/toolbar.test \PatternsToolbarTestCase::test_toolbar()

Test the:

  • change some role's permission to let it have the access to see toolbar.

File

tests/toolbar/toolbar.test, line 40
SimpleTests for the Toolbar component of Patterns.

Class

PatternsToolbarTestCase
@file SimpleTests for the Toolbar component of Patterns.

Code

public function test_toolbar() {

  //for add 'access toolbar' permission to the 'anonymous user' role
  parent::runFile('toolbar_add.yaml', 'Toolbarrole (add)', $this->toolbar_tests_dir);
  $query = db_select('role_permission', 'rp')
    ->fields('rp', array(
    'rid',
    'permission',
  ))
    ->condition('rp.rid', 1)
    ->condition('rp.permission', 'access toolbar')
    ->execute()
    ->fetchAssoc();
  $this
    ->assertTrue($query, t('Adding \'access toolbar\' works fine.'));

  //for delete 'access toolbar' permission from the 'anonymous user' role
  parent::runFile('toolbar_delete.yaml', 'Toolbarrole (delete)', $this->toolbar_tests_dir);
  $query = db_select('role_permission', 'rp')
    ->fields('rp', array(
    'rid',
    'permission',
  ))
    ->condition('rp.rid', 1)
    ->condition('rp.permission', 'access toolbar')
    ->execute()
    ->fetchAssoc();
  $this
    ->assertFalse($query, t('Deleting \'access toolbar\' works fine.'));
}