You are here

classified_test.module in Classified Ads 7.3

Helper module for the Classified ads tests.

File

tests/classified_test.module
View source
<?php

/**
 * @file
 * Helper module for the Classified ads tests.
 */

/**
 * Implements hook_menu().
 *
 * Module only creates 2 terms, tid 1 and 2, so 3 is invalid.
 */
function classified_test_menu() {
  $items['classified-test/invalid-term-path'] = array(
    'title' => 'Invalid Taxonomy path',
    'page callback' => 'classified_test_page_invalid_term_path',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

/**
 * Build a taxonomy term path to a tid one higher than the highest existing tid.
 *
 * This will be an incorrect URL, which must not be modified. Issue #1412840
 *
 * @see classified_url_outbound_alter()
 */
function classified_test_page_invalid_term_path() {
  $q = db_select('taxonomy_term_data');
  $q
    ->addExpression('MAX(tid)');
  $tid = $q
    ->execute()
    ->fetchField();
  $tid++;
  $ret = url("taxonomy/term/{$tid}");
  return $ret;
}

Functions

Namesort descending Description
classified_test_menu Implements hook_menu().
classified_test_page_invalid_term_path Build a taxonomy term path to a tid one higher than the highest existing tid.