You are here

protected function ClassifiedAbstractTest::createNode in Classified Ads 6.3

Build a node from settings, providing classified-specific defaults.

Parameters

array $settings: Array of non-default ad properties and fields, overriding defaults provided in this function.

Return value

object The new node, reloaded from DB.

9 calls to ClassifiedAbstractTest::createNode()
ClassifiedBasicTest::test0123396 in tests/classified_basic.test
Bug 123396: Unchecking 'Publish' checkbox doesn't prevent nodes from being published.
ClassifiedBasicTest::test1269828 in tests/classified_basic.test
Bug 1269828
ClassifiedBasicTest::test1287674 in tests/classified_basic.test
Bug 1287674
ClassifiedBasicTest::test1397422 in tests/classified_basic.test
Bug 1397422
ClassifiedBasicTest::test1432606 in tests/classified_basic.test
Bug 1432606: Ads can be viewed when not published.

... See full list

File

tests/classified_basic.test, line 33
Basic test for known bugs in previous versions.

Class

ClassifiedAbstractTest
Test known fixed bugs to catch regressions.

Code

protected function createNode($settings) {
  if (!isset($settings['taxonomy'])) {
    $vid = _classified_get('vid');
    $term_name = $this
      ->randomName(4) . " ' " . $this
      ->randomName(4);
    $term = array(
      'name' => $term_name,
      'description' => $this
        ->randomString(20),
      'vid' => $vid,
    );
    $status = taxonomy_save_term($term);
    $tid = $term['tid'];
    $settings['taxonomy'] = array(
      $vid => $tid,
    );
  }
  $settings += array(
    'title' => $this
      ->randomString(10),
    'body' => $this
      ->randomString(100),
    'type' => 'classified',
    'status' => 1,
  );
  $node = $this
    ->drupalCreateNode($settings);

  // Taxonomy is not in the same format as right after creation.
  $node = node_load($node->nid, NULL, TRUE);
  return $node;
}