You are here

private function AcquiaLiftsWebTest::createArticleWithTerms in Acquia Lift Connector 7.3

Creates an article with the specified terms.

Parameters

array $autocreate: (optional) An array of term names to autocreate. Defaults to array().

array $existing: (optional) An array of existing term IDs to add.

Return value

object The node object.

1 call to AcquiaLiftsWebTest::createArticleWithTerms()
AcquiaLiftsWebTest::setUp in tests/acquia_lift.test
Sets up a Drupal site for running functional and integration tests.

File

tests/acquia_lift.test, line 598
Tests for Acquia Lift Profiles module.

Class

AcquiaLiftsWebTest
Tests Acquia Lift functionality.

Code

private function createArticleWithTerms($autocreate = array(), $existing = array()) {
  $values = array();
  foreach ($autocreate as $name) {
    $values[] = array(
      'tid' => 'autocreate',
      'vid' => 1,
      'name' => $name,
      'vocabulary_machine_name' => 'tags',
    );
  }
  foreach ($existing as $tid) {
    $values[] = array(
      'tid' => $tid,
      'vid' => 1,
      'vocabulary_machine_name' => 'tags',
    );
  }
  $values = array(
    LANGUAGE_NONE => $values,
  );
  $settings = array(
    'type' => 'article',
    'field_tags' => $values,
  );
  return $this
    ->drupalCreateNode($settings);
}