You are here

protected function CommerceReportsTaxGenerationTests::permissionBuilder in Commerce Reporting 7.3

Helper function to get different combinations of permission sets.

Parameters

$set: Can be a single string (from the following) or can be an array containing multiple values that should be merged: 'site admin': Admin permissions for Drupal core modules 'store admin': All commerce "administer X" permissions

Overrides CommerceBaseTestCase::permissionBuilder

File

modules/tax/tests/commerce_reports_tax.test, line 30
Tests for commerce tax reporting module.

Class

CommerceReportsTaxGenerationTests
@file Tests for commerce tax reporting module.

Code

protected function permissionBuilder($sets) {
  if (is_string($sets)) {
    $sets = array(
      $sets,
    );
  }
  $store_admin = array(
    'access commerce tax reports',
    'configure commerce tax reports',
  );
  $final_permissions = parent::permissionBuilder($sets);
  foreach ($sets as $set) {
    switch ($set) {
      case 'store admin':
        $final_permissions = array_unique(array_merge($final_permissions, $store_admin));
        break;
    }
  }
  return $final_permissions;
}