You are here

public function ClassifiedTestTestBasicTest::test1244300 in Classified Ads 7.3

Bug 1244300: Anonymous user unable to post regardless of permission grants.

File

tests/classified_test_basic.test, line 174

Class

ClassifiedTestTestBasicTest
Basic test for known bugs in previous versions.

Code

public function test1244300() {
  $this->group = __FUNCTION__;
  $this
    ->assertFalse(in_array('create classified ad content', array_keys(module_invoke_all('permission'))), t('D6-style node creation permission is not valid'), $this->group);
  $permissions = array(
    'create classified content',
  );
  $this
    ->assertTrue($this
    ->checkPermissions($permissions, TRUE), t('D7-style node creation permission is valid'), $this->group);
  user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, $permissions);
  $this
    ->drupalGet('node/add/classified');
  $this
    ->assertResponse(403, t('Anonymous user without %permissions may not access the ad creation form', array(
    '%permissions' => implode(', ', $permissions),
  )), $this->group);
  user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, $permissions);

  // Use:
  // debug(user_role_permissions(array(DRUPAL_ANONYMOUS_RID => NULL)));
  // when needing to check the grant results.
  $this
    ->drupalGet('node/add/classified');
  $this
    ->assertResponse(200, t('Anonymous user with %permissions may access the ad creation form', array(
    '%permissions' => implode(', ', $permissions),
  )), $this->group);
}