You are here

function TaxonomyAccessConfigTest::createPage in Taxonomy Access Control 7

Creates a page with the specified terms.

Parameters

array $terms: (optional) An array of term names to tag the page. Defaults to array().

Return value

object The node object.

2 calls to TaxonomyAccessConfigTest::createPage()
TaxonomyAccessConfigTest::setUp in ./taxonomy_access.test
Sets up a Drupal site for running functional and integration tests.
TaxonomyAccessConfigTest::testTermWithChildren in ./taxonomy_access.test
Tests adding a term configuration with children.

File

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

Class

TaxonomyAccessConfigTest
Tests the module's configuration forms.

Code

function createPage($tags = array()) {
  $v1 = array();
  $v2 = array();
  foreach ($tags as $name) {
    switch ($this->terms[$name]->vid) {
      case $this->vocabs['v1']->vid:
        $v1[] = array(
          'tid' => $this->terms[$name]->tid,
        );
        break;
      case $this->vocabs['v2']->vid:
        $v2[] = array(
          'tid' => $this->terms[$name]->tid,
        );
        break;
    }
  }

  // Bloody $langcodes.
  $v1 = array(
    LANGUAGE_NONE => $v1,
  );
  $v2 = array(
    LANGUAGE_NONE => $v2,
  );
  $settings = array(
    'type' => 'page',
    'v1' => $v1,
    'v2' => $v2,
  );
  return $this
    ->drupalCreateNode($settings);
}