123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- /**
- * @file
- * Unit tests for the XML sitemap engines project.
- */
- /**
- * Implements hook_menu().
- */
- function xmlsitemap_engines_test_menu() {
- $items['ping'] = array(
- 'page callback' => 'xmlsitemap_engines_test_pinged',
- // @codingStandardsIgnoreLine
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
- return $items;
- }
- /**
- * Implements hook_xmlsitemap_engine_info().
- */
- function xmlsitemap_engines_test_xmlsitemap_engine_info() {
- $engines['simpletest'] = array(
- 'name' => t('SimpleTest'),
- 'url' => 'http://example.com/',
- );
- return $engines;
- }
- /**
- * Implements hook_xmlsitemap_engine_info_alter().
- */
- function xmlsitemap_engines_test_xmlsitemap_engine_info_alter(&$engines) {
- $engines['simpletest']['url'] = url('ping', array('absolute' => TRUE, 'query' => array('sitemap' => ''))) . '[sitemap]';
- }
- /**
- * Test pinged.
- */
- function xmlsitemap_engines_test_pinged() {
- if (empty($_GET['sitemap']) || !valid_url($_GET['sitemap'])) {
- watchdog('xmlsitemap', 'No valid sitemap parameter provided.', array(), WATCHDOG_WARNING);
- // @todo Remove this? Causes an extra watchdog error to be handled.
- return MENU_NOT_FOUND;
- }
- else {
- watchdog('xmlsitemap', 'Recieved ping for @sitemap.', array('@sitemap' => $_GET['sitemap']));
- }
- }
|