You are here

protected function ClassifiedTestAbstractTest::createUsers in Classified Ads 7.3

Create a set of typical users with profiles related to Classified Ads.

Parameters

array $profiles:

  • admin: a Classified Ads administrator,
  • basic: a typical Classified Ads user,
  • creator: a user allowed to post Classified Ads.
10 calls to ClassifiedTestAbstractTest::createUsers()
ClassifiedTestNotificationsTest::test1441396 in tests/classified_test_notifications.test
Issue #1441396.
ClassifiedTestNotificationsTest::test1491880 in tests/classified_test_notifications.test
Issue 1491880.
ClassifiedTestTestBasicTest::test0547214 in tests/classified_test_basic.test
Bug 547214: view Ads tab for users without permission.
ClassifiedTestTestBasicTest::test1265524 in tests/classified_test_basic.test
Bug 1265524: Can not edit taxonomy terms.
ClassifiedTestTestBasicTest::test1287674 in tests/classified_test_basic.test
Bug 1287674.

... See full list

File

tests/classified_test_abstract.test, line 84

Class

ClassifiedTestAbstractTest
Base class to Test known fixed bugs to catch regressions.

Code

protected function createUsers(array $profiles = array()) {
  if (in_array('admin', $profiles)) {
    $this->adminUser = $this
      ->drupalCreateUser(array(
      // block.module, to access admin/build/block.
      'administer blocks',
      // classified.module.
      'administer classified ads',
      // node.module.
      'access content',
      // system.module, to access admin/reports/status.
      'administer site configuration',
      // taxonomy.module.
      'administer taxonomy',
      // user.module.
      'access user profiles',
    ));
    $this
      ->pass(t('Admin user %name (%uid) created.', array(
      '%name' => $this->adminUser->name,
      '%uid' => $this->adminUser->uid,
    )), $this->group);
  }
  if (in_array('basic', $profiles)) {
    $this->basicUser = $this
      ->drupalCreateUser(array(
      'access content',
    ));
    $this
      ->pass(t('Basic user %name (%uid) created.', array(
      '%name' => $this->basicUser->name,
      '%uid' => $this->basicUser->uid,
    )), $this->group);
  }
  if (in_array('creator', $profiles)) {
    $this->creatorUser = $this
      ->drupalCreateUser(array(
      'access content',
      'access user profiles',
      'create classified content',
      'view own unpublished content',
    ));
    $this
      ->pass(t('Creator user %name (%uid) created.', array(
      '%name' => $this->creatorUser->name,
      '%uid' => $this->creatorUser->uid,
    )), $this->group);
  }
}