public function TaxonomyAccessConfigTest::testTermWithChildren in Taxonomy Access Control 7
Tests adding a term configuration with children.
@todo Check that node access is updated for these as well.
File
- ./
taxonomy_access.test, line 940 - Automated tests for the Taxonomy Access Control module.
Class
- TaxonomyAccessConfigTest
- Tests the module's configuration forms.
Code
public function testTermWithChildren() {
// Create some additional taxonomy terms in a hierarchy:
// v1
// - v1t1
// - - v1t1c1
// - - - v1t1c1g1
// - - - v1t1c1g2
// - - v1t1c2
// - - v1t2
$this->terms['v1t1c1'] = $this
->createTerm('v1t1c1', $this->vocabs['v1'], $this->terms['v1t1']->tid);
$this->terms['v1t1c2'] = $this
->createTerm('v1t1c2', $this->vocabs['v1'], $this->terms['v1t1']->tid);
$this->terms['v1t1c1g1'] = $this
->createTerm('v1t1c1g1', $this->vocabs['v1'], $this->terms['v1t1c1']->tid);
$this->terms['v1t1c1g2'] = $this
->createTerm('v1t1c1g2', $this->vocabs['v1'], $this->terms['v1t1c1']->tid);
// Add pages tagged with each.
foreach (array(
'v1t1c1',
'v1t1c2',
'v1t1c1g1',
'v1t1c1g2',
) as $name) {
$this->pages[$name] = $this
->createPage(array(
$name,
));
}
// Log in as the administrator.
$this
->drupalLogin($this->users['site_admin']);
// Enable v1 programmatically.
taxonomy_access_enable_vocab($this->vocabs['v1']->vid, DRUPAL_ANONYMOUS_RID);
// Use the admin form to give anonymous view allow for v1t1 and children.
$this
->drupalGet(TAXONOMY_ACCESS_CONFIG . '/role/' . DRUPAL_ANONYMOUS_RID . '/edit');
$edit = array();
$edit["new[{$this->vocabs['v1']->vid}][recursive]"] = 1;
$this
->addFormRow($edit, $this->vocabs['v1']->vid, $this->terms['v1t1']->tid, TAXONOMY_ACCESS_NODE_ALLOW);
$this
->drupalPost(NULL, $edit, 'Add');
}