You are here

public function AccessWebTestCase::createTaxonomyTermScheme in Access Control Kit 7

Creates a taxonomy-based scheme with randomly named realms.

Parameters

string $machine_name: The vocabulary machine name.

Return value

object An access scheme.

2 calls to AccessWebTestCase::createTaxonomyTermScheme()
AccessPluginTest::testHanderInfo in ./access.test
Check that handlers are defined correctly.
AccessPluginTest::testSchemeInfo in ./access.test
Check that scheme types are defined correctly.

File

./access.test, line 107
Tests for the access control kit module.

Class

AccessWebTestCase
Provides common helper methods for access control kit module tests.

Code

public function createTaxonomyTermScheme($machine_name) {
  $vocabulary = new stdClass();
  $vocabulary->name = $this
    ->randomName();
  $vocabulary->machine_name = $machine_name;
  $vocabulary->hierarchy = 0;
  taxonomy_vocabulary_save($vocabulary);
  for ($i = 0; $i < 3; $i++) {
    $term = new stdClass();
    $term->vid = $vocabulary->vid;
    $term->name = $this
      ->randomName();
    taxonomy_term_save($term);
  }
  $scheme = $this
    ->createScheme('taxonomy_term', array(
    'vocabulary' => $vocabulary->machine_name,
  ));
  return access_scheme_load($scheme->sid);
}