You are here

protected function ClassifiedAbstractTest::createUsers in Classified Ads 6.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
12 calls to ClassifiedAbstractTest::createUsers()
ClassifiedBasicTest::test0547214 in tests/classified_basic.test
Bug 547214: view Ads tab for users without permission.
ClassifiedBasicTest::test1269828 in tests/classified_basic.test
Bug 1269828
ClassifiedBasicTest::test1287674 in tests/classified_basic.test
Bug 1287674
ClassifiedBasicTest::test1382234 in tests/classified_basic.test
Issue #1382234: Create new ad link missing.
ClassifiedBasicTest::test1397422 in tests/classified_basic.test
Bug 1397422

... See full list

File

tests/classified_basic.test, line 68
Basic test for known bugs in previous versions.

Class

ClassifiedAbstractTest
Test known fixed bugs to catch regressions.

Code

protected function createUsers($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 ad content',
    ));
    $this
      ->pass(t('Creator user %name (%uid) created.', array(
      '%name' => $this->creatorUser->name,
      '%uid' => $this->creatorUser->uid,
    )), $this->group);
  }
}