You are here

function TaxonomyAccessTestCase::addFormRow in Taxonomy Access Control 7

Adds a term row on the role configuration form.

Parameters

array &$edit: The form data to post.

int $vid: (optional) The vocabulary ID. Defaults to TAXONOMY_ACCESS_GLOBAL_DEFAULT.

$int tid: (optional) The term ID. Defaults to TAXONOMY_ACCESS_VOCABULARY_DEFAULT.

int $view: (optional) The view grant value. Defaults to TAXONOMY_ACCESS_NODE_IGNORE.

int $update: (optional) The update grant value. Defaults to

int $delete: (optional) The delete grant value. Defaults to TAXONOMY_ACCESS_NODE_IGNORE.

int $create: (optional) The create grant value. Defaults to TAXONOMY_ACCESS_TERM_DENY.

int $list: (optional) The list grant value. Defaults to TAXONOMY_ACCESS_TERM_DENY.

2 calls to TaxonomyAccessTestCase::addFormRow()
TaxonomyAccessConfigTest::testTermConfig in ./taxonomy_access.test
Tests configuring specific terms.
TaxonomyAccessConfigTest::testTermWithChildren in ./taxonomy_access.test
Tests adding a term configuration with children.

File

./taxonomy_access.test, line 350
Automated tests for the Taxonomy Access Control module.

Class

TaxonomyAccessTestCase
Provides a base test class and helper methods for automated tests.

Code

function addFormRow(&$edit, $vid = TAXONOMY_ACCESS_GLOBAL_DEFAULT, $tid = TAXONOMY_ACCESS_VOCABULARY_DEFAULT, $view = TAXONOMY_ACCESS_NODE_IGNORE, $update = TAXONOMY_ACCESS_NODE_IGNORE, $delete = TAXONOMY_ACCESS_NODE_IGNORE, $create = TAXONOMY_ACCESS_TERM_DENY, $list = TAXONOMY_ACCESS_TERM_DENY) {
  $new_value = $tid ? "term {$tid}" : "default {$vid}";
  $edit["new[{$vid}][item]"] = $new_value;
  $edit["new[{$vid}][grants][{$vid}][0][view]"] = $view;
  $edit["new[{$vid}][grants][{$vid}][0][update]"] = $update;
  $edit["new[{$vid}][grants][{$vid}][0][delete]"] = $delete;
  $edit["new[{$vid}][grants][{$vid}][0][create]"] = $create;
  $edit["new[{$vid}][grants][{$vid}][0][list]"] = $list;
}