summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.26/modules/aggregator/tests
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.26/modules/aggregator/tests')
-rw-r--r--kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test.info12
-rw-r--r--kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test.module58
-rw-r--r--kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test_atom.xml20
-rw-r--r--kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test_rss091.xml41
4 files changed, 131 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test.info b/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test.info
new file mode 100644
index 0000000..a122ba2
--- /dev/null
+++ b/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test.info
@@ -0,0 +1,12 @@
+name = "Aggregator module tests"
+description = "Support module for aggregator related testing."
+package = Testing
+version = VERSION
+core = 7.x
+hidden = TRUE
+
+; Information added by Drupal.org packaging script on 2014-01-15
+version = "7.26"
+project = "drupal"
+datestamp = "1389815930"
+
diff --git a/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test.module b/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test.module
new file mode 100644
index 0000000..2d26a5d
--- /dev/null
+++ b/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test.module
@@ -0,0 +1,58 @@
+<?php
+
+/**
+ * Implements hook_menu().
+ */
+function aggregator_test_menu() {
+ $items['aggregator/test-feed'] = array(
+ 'title' => 'Test feed static last modified date',
+ 'description' => "A cached test feed with a static last modified date.",
+ 'page callback' => 'aggregator_test_feed',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK,
+ );
+ return $items;
+}
+
+/**
+ * Page callback. Generates a test feed and simulates last-modified and etags.
+ *
+ * @param $use_last_modified
+ * Set TRUE to send a last modified header.
+ * @param $use_etag
+ * Set TRUE to send an etag.
+ */
+function aggregator_test_feed($use_last_modified = FALSE, $use_etag = FALSE) {
+ $last_modified = strtotime('Sun, 19 Nov 1978 05:00:00 GMT');
+ $etag = drupal_hash_base64($last_modified);
+
+ $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : FALSE;
+ $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : FALSE;
+
+ // Send appropriate response. We respond with a 304 not modified on either
+ // etag or on last modified.
+ if ($use_last_modified) {
+ drupal_add_http_header('Last-Modified', gmdate(DATE_RFC1123, $last_modified));
+ }
+ if ($use_etag) {
+ drupal_add_http_header('ETag', $etag);
+ }
+ // Return 304 not modified if either last modified or etag match.
+ if ($last_modified == $if_modified_since || $etag == $if_none_match) {
+ drupal_add_http_header('Status', '304 Not Modified');
+ return;
+ }
+
+ // The following headers force validation of cache:
+ drupal_add_http_header('Expires', 'Sun, 19 Nov 1978 05:00:00 GMT');
+ drupal_add_http_header('Cache-Control', 'must-revalidate');
+ drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
+
+ // Read actual feed from file.
+ $file_name = DRUPAL_ROOT . '/' . drupal_get_path('module', 'aggregator') . '/tests/aggregator_test_rss091.xml';
+ $handle = fopen($file_name, 'r');
+ $feed = fread($handle, filesize($file_name));
+ fclose($handle);
+
+ print $feed;
+}
diff --git a/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test_atom.xml b/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test_atom.xml
new file mode 100644
index 0000000..357b2e5
--- /dev/null
+++ b/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test_atom.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+
+ <title>Example Feed</title>
+ <link href="http://example.org/" />
+ <updated>2003-12-13T18:30:02Z</updated>
+ <author>
+ <name>John Doe</name>
+ </author>
+ <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
+
+ <entry>
+ <title>Atom-Powered Robots Run Amok</title>
+ <link href="http://example.org/2003/12/13/atom03" />
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+ <updated>2003-12-13T18:30:02Z</updated>
+ <summary>Some text.</summary>
+ </entry>
+
+</feed>
diff --git a/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test_rss091.xml b/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test_rss091.xml
new file mode 100644
index 0000000..2944022
--- /dev/null
+++ b/kolab.org/www/drupal-7.26/modules/aggregator/tests/aggregator_test_rss091.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rss version="0.91">
+ <channel>
+ <title>Example</title>
+ <link>http://example.com</link>
+ <description>Example updates</description>
+ <language>en-us</language>
+ <copyright>Copyright 2000, Example team.</copyright>
+ <managingEditor>editor@example.com</managingEditor>
+ <webMaster>webmaster@example.com</webMaster>
+ <image>
+ <title>Example</title>
+ <url>http://example.com/images/druplicon.png</url>
+ <link>http://example.com</link>
+ <width>88</width>
+ <height>100</height>
+ <description>Example updates</description>
+ </image>
+ <item>
+ <title>First example feed item title</title>
+ <link>http://example.com/example-turns-one</link>
+ <description>First example feed item description.</description>
+ </item>
+ <item>
+ <title>Second example feed item title. This title is extremely long so that it exceeds the 255 character limit for titles in feed item storage. In fact it's so long that this sentence isn't long enough so I'm rambling a bit to make it longer, nearly there now. Ah now it's long enough so I'll shut up.</title>
+ <link>http://example.com/example-turns-two</link>
+ <description>Second example feed item description.</description>
+ </item>
+ <item>
+ <title>Long link feed item title.</title>
+ <link>http://example.com/tomorrow/and/tomorrow/and/tomorrow/creeps/in/this/petty/pace/from/day/to/day/to/the/last/syllable/of/recorded/time/and/all/our/yesterdays/have/lighted/fools/the/way/to/dusty/death/out/out/brief/candle/life/is/but/a/walking/shadow/a/poor/player/that/struts/and/frets/his/hour/upon/the/stage/and/is/heard/no/more/it/is/a/tale/told/by/an/idiot/full/of/sound/and/fury/signifying/nothing</link>
+ <description>Long link feed item description.</description>
+ </item>
+ <item>
+ <title>Long author feed item title.</title>
+ <link>http://example.com/long/author</link>
+ <author>I wanted to get out and walk eastward toward the park through the soft twilight, but each time I tried to go I became entangled in some wild, strident argument which pulled me back, as if with ropes, into my chair. Yet high over the city our line of yellow windows must have contributed their share of human secrecy to the casual watcher in the darkening streets, and I was him too, looking up and wondering. I was within and without, simultaneously enchanted and repelled by the inexhaustible variety of life.</author>
+ <description>Long author feed item description.</description>
+ </item>
+ </channel>
+</rss>