Skip to content
Snippets Groups Projects
Commit 8b778852 authored by Kevin Abel's avatar Kevin Abel
Browse files

A PHPT integration tests

Tests that the RAVE RSS feed is working and that a point-in-time example
can be translated into CAP XML.
parent 3b325a57
No related branches found
No related tags found
No related merge requests found
--TEST--
Basic RSS feed parsing, recent checking, and output
--FILE--
<?php
require_once dirname(__FILE__).'/config.inc.php';
require_once dirname(__FILE__).'/../scripts/functions.inc.php';
$outputObject = getCAPData($config);
echo $outputObject->toXML('alert', 'urn:oasis:names:tc:emergency:cap:1.2');
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2"><identifier>044972ad186d3901e0079ed73c54653d</identifier><sender>police.unl.edu</sender><sent>2014-06-10T19:17:39+00:00</sent><status>Test</status><msgType>Alert</msgType><scope>Public</scope><note>This is only a test</note><info><category>Safety</category><event>UNL Alert</event><ugency>Immediate</ugency><severity>Extreme</severity><certainty>Observed</certainty><headline>Mark Only Test</headline><description>UNL Alert: this is a test</description><web>http://www.unl.edu/</web></info></alert>
<?php
function autoload($class)
{
$class = str_replace(array('_', '\\'), '/', $class);
include $class . '.php';
}
spl_autoload_register('autoload');
set_include_path(__DIR__ . '/../src' );
$config = array(
'proxyUrl' => __DIR__ . '/data/rave.xml',
'recentTimeframe' => '2014-06-10T18:47:39Z',
);
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title>UNL Alert UCOMM</title>
<link>http://www.getrave.com/rss/unl/channel1</link>
<description>UNL Alert RSS</description>
<category>Alerts</category>
<dc:subject>Alerts</dc:subject>
<item>
<title>Mark Only Test</title>
<link />
<description>UNL Alert: this is a test</description>
<category>Alerts</category>
<pubDate>Tue, 10 Jun 2014 19:17:39 GMT</pubDate>
<guid />
<dc:date>2014-06-10T19:17:39Z</dc:date>
</item>
</channel>
</rss>
--TEST--
Live RSS feed from vendor
--FILE--
<?php
require_once dirname(__FILE__).'/config.inc.php';
$alerts = new UNL_Alert_RaveRSS('http://www.getrave.com/rss/unl/channel1');
echo "DONE";
--EXPECT--
DONE
unlAlerts.data = {}
unlAlerts.data = {};
try {
unlAlerts.server.init();
} catch(e) {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment