security update for uuid xmlsitemap file_field_path

This commit is contained in:
2018-10-13 16:01:24 +02:00
parent f7ae17e6c4
commit a163542966
109 changed files with 5458 additions and 1952 deletions

View File

@@ -5,9 +5,25 @@
* Tests for the xmlsitemap_engines module.
*/
/**
* Functional Test.
*
* @codingStandardsIgnoreStart
*/
class XMLSitemapEnginesFunctionalTest extends XMLSitemapTestHelper {
/**
* Submit URL.
*
* @var string
*/
protected $submit_url;
/**
* Get Info.
*
* @codingStandardsIgnoreEnd
*/
public static function getInfo() {
return array(
'name' => 'XML sitemap engines functional tests',
@@ -16,7 +32,10 @@ class XMLSitemapEnginesFunctionalTest extends XMLSitemapTestHelper {
);
}
function setUp($modules = array()) {
/**
* Setup.
*/
public function setUp($modules = array()) {
$modules[] = 'xmlsitemap_engines';
$modules[] = 'xmlsitemap_engines_test';
parent::setUp($modules);
@@ -32,7 +51,10 @@ class XMLSitemapEnginesFunctionalTest extends XMLSitemapTestHelper {
$this->submit_url = url('ping', array('absolute' => TRUE, 'query' => array('sitemap' => ''))) . '[sitemap]';
}
function submitEngines() {
/**
* Submit Engines.
*/
public function submitEngines() {
variable_set('xmlsitemap_engines_submit_last', REQUEST_TIME - 10000);
variable_set('xmlsitemap_generated_last', REQUEST_TIME - 100);
variable_set('xmlsitemap_engines_minimum_lifetime', 0);
@@ -40,14 +62,23 @@ class XMLSitemapEnginesFunctionalTest extends XMLSitemapTestHelper {
$this->assertTrue(variable_get('xmlsitemap_engines_submit_last', 0) > (REQUEST_TIME - 100), 'Submitted the sitemaps to search engines.');
}
function testPrepareURL() {
/**
* Test Prepare URL.
*
* @codingStandardsIgnoreStart
*/
public function testPrepareURL() {
// @codingStandardsIgnoreEnd
$sitemap = 'http://example.com/sitemap.xml';
$input = 'http://example.com/ping?sitemap=[sitemap]&foo=bar';
$output = 'http://example.com/ping?sitemap=http://example.com/sitemap.xml&foo=bar';
$this->assertEqual(xmlsitemap_engines_prepare_url($input, $sitemap), $output);
}
function testSubmitSitemaps() {
/**
* Test Submit Sitemaps.
*/
public function testSubmitSitemaps() {
$sitemaps = array();
$sitemap = new stdClass();
$sitemap->uri = array(
@@ -63,11 +94,26 @@ class XMLSitemapEnginesFunctionalTest extends XMLSitemapTestHelper {
$sitemaps[] = $sitemap;
xmlsitemap_engines_submit_sitemaps($this->submit_url, $sitemaps);
$this->assertWatchdogMessage(array('type' => 'xmlsitemap', 'message' => 'Recieved ping for @sitemap.', 'variables' => array('@sitemap' => 'http://example.com/sitemap.xml')));
$this->assertWatchdogMessage(array('type' => 'xmlsitemap', 'message' => 'Recieved ping for @sitemap.', 'variables' => array('@sitemap' => 'http://example.com/sitemap-2.xml')));
$this->assertWatchdogMessage(array(
'type' => 'xmlsitemap',
'message' => 'Recieved ping for @sitemap.',
'variables' => array(
'@sitemap' => 'http://example.com/sitemap.xml',
),
));
$this->assertWatchdogMessage(array(
'type' => 'xmlsitemap',
'message' => 'Recieved ping for @sitemap.',
'variables' => array(
'@sitemap' => 'http://example.com/sitemap-2.xml',
),
));
}
function testPing() {
/**
* Test Ping.
*/
public function testPing() {
$edit = array('xmlsitemap_engines_engines[simpletest]' => TRUE);
$this->drupalPost('admin/config/search/xmlsitemap/engines', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'));
@@ -77,7 +123,13 @@ class XMLSitemapEnginesFunctionalTest extends XMLSitemapTestHelper {
$this->assertWatchdogMessage(array('type' => 'xmlsitemap', 'message' => 'Recieved ping for @sitemap.'));
}
function testCustomURL() {
/**
* Test Custom URL.
*
* @codingStandardsIgnoreStart
*/
public function testCustomURL() {
// @codingStandardsIgnoreEnd
$edit = array('xmlsitemap_engines_custom_urls' => 'an-invalid-url');
$this->drupalPost('admin/config/search/xmlsitemap/engines', $edit, t('Save configuration'));
$this->assertText('Invalid URL an-invalid-url.');
@@ -89,7 +141,14 @@ class XMLSitemapEnginesFunctionalTest extends XMLSitemapTestHelper {
$this->assertText(t('The configuration options have been saved.'));
$this->submitEngines();
$this->assertWatchdogMessage(array('type' => 'xmlsitemap', 'message' => 'Submitted the sitemap to %url and received response @code.', 'variables' => array('%url' => $url, '@code' => '404')));
$this->assertWatchdogMessage(array(
'type' => 'xmlsitemap',
'message' => 'Submitted the sitemap to %url and received response @code.',
'variables' => array(
'%url' => $url,
'@code' => '404',
),
));
$this->assertWatchdogMessage(array('type' => 'xmlsitemap', 'message' => 'No valid sitemap parameter provided.'));
$this->assertWatchdogMessage(array('type' => 'page not found', 'message' => 'ping'));
@@ -99,7 +158,23 @@ class XMLSitemapEnginesFunctionalTest extends XMLSitemapTestHelper {
$this->submitEngines();
$url = xmlsitemap_engines_prepare_url($this->submit_url, url('sitemap.xml', array('absolute' => TRUE)));
$this->assertWatchdogMessage(array('type' => 'xmlsitemap', 'message' => 'Submitted the sitemap to %url and received response @code.', 'variables' => array('%url' => $url, '@code' => '200')));
$this->assertWatchdogMessage(array('type' => 'xmlsitemap', 'message' => 'Recieved ping for @sitemap.', 'variables' => array('@sitemap' => url('sitemap.xml', array('absolute' => TRUE)))));
$this->assertWatchdogMessage(array(
'type' => 'xmlsitemap',
'message' => 'Submitted the sitemap to %url and received response @code.',
'variables' => array(
'%url' => $url,
'@code' => '200',
),
));
$this->assertWatchdogMessage(array(
'type' => 'xmlsitemap',
'message' => 'Recieved ping for @sitemap.',
'variables' => array(
'@sitemap' => url('sitemap.xml', array(
'absolute' => TRUE,
)),
),
));
}
}

View File

@@ -2,13 +2,10 @@ name = XML sitemap engines test
description = Support module for XML sitemap engines testing.
package = Testing
core = 7.x
files[] = xmlsitemap_engines_test.module
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2016-05-25
version = "7.x-2.3"
; Information added by Drupal.org packaging script on 2018-10-09
version = "7.x-2.6"
core = "7.x"
project = "xmlsitemap"
datestamp = "1464191061"
datestamp = "1539120486"

View File

@@ -1,11 +1,17 @@
<?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,
);
@@ -30,6 +36,9 @@ 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);