You are here

function ClassifiedBasicTest::test1397422 in Classified Ads 6.3

Bug 1397422

File

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

Class

ClassifiedBasicTest

Code

function test1397422() {
  $this->group = __FUNCTION__;
  $this
    ->createUsers(array(
    'creator',
  ));
  $this
    ->drupalLogin($this->creatorUser);
  $types = array_keys(classified_node_info());
  $type = reset($types);

  // Get the Classified vocabulary id
  $vid = _classified_get('vid');

  // Create a term in it, do not assign a specific lifetime.
  $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'];
  $this
    ->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
    '@tid' => $tid,
  )), 'setup');

  // Create a node bearing that term.
  $title = $this
    ->randomName(4) . ' ' . $this
    ->randomName(4);
  module_load_include('inc', 'node', 'node.pages');
  $body = $this
    ->randomName(4) . ' ' . $this
    ->randomString(40);
  $format = FILTER_FORMAT_DEFAULT;
  $settings = array(
    'type' => $type,
    'format' => $format,
    'taxonomy' => array(
      $vid => $tid,
    ),
    'title' => $title,
    'body' => $body,
  );
  $node = $this
    ->createNode($settings);
  variable_set('classified-list-body', 'body');
  $this
    ->assertEqual(_classified_get('list-body'), 'body', t('List display set to node body'), $this->group);
  $path = classified_term_path((object) $term);
  $this
    ->drupalGet($path);
  $this
    ->assertLink($title, 0, t('Title link found'), $this->group);
  $this
    ->assertRaw(check_markup($body, $format, TRUE), 0, t('Body found'), $this->group);
}