1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-31 02:32:37 +02:00

XML tests added.

This commit is contained in:
Cameron 2019-01-24 09:15:19 -08:00
parent 36c92f893e
commit 602dc4f939

View File

@ -30,12 +30,18 @@
{
}
*/
public function testLoadXMLfile()
{
$feed = 'https://www.youtube.com/feeds/videos.xml?channel_id=UC7vv3cBq14FRXajteZt6FEg';
$contents = $this->_xml->reset(true)->loadXMLFile($feed,true);
$this->assertNotEmpty($contents);
// print_r($contents);
}
/*
public function testSetOptFilter()
{
@ -45,12 +51,53 @@
{
}
*/
public function testParseXml()
{
$raw = '<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:yt="http://www.youtube.com/xml/schemas/2015" xmlns:media="http://search.yahoo.com/mrss/" xmlns="http://www.w3.org/2005/Atom">
<link rel="self" href="http://www.youtube.com/feeds/videos.xml?channel_id=UC7vv3cBq14FRXajteZt6FEg"/>
<id>yt:channel:UC7vv3cBq14FRXajteZt6FEg</id>
<yt:channelId>UC7vv3cBq14FRXajteZt6FEg</yt:channelId>
<title>egucom2014</title>
<link rel="alternate" href="https://www.youtube.com/channel/UC7vv3cBq14FRXajteZt6FEg"/>
<author>
<name>egucom2014</name>
<uri>https://www.youtube.com/channel/UC7vv3cBq14FRXajteZt6FEg</uri>
</author>
<published>2016-01-17T11:31:33+00:00</published>
<entry>
<id>yt:video:palm1QdV8ZI</id>
<yt:videoId>palm1QdV8ZI</yt:videoId>
<yt:channelId>UC7vv3cBq14FRXajteZt6FEg</yt:channelId>
<title>[EGU] Erstes Offizielles Intro</title>
<link rel="alternate" href="https://www.youtube.com/watch?v=palm1QdV8ZI"/>
<author>
<name>egucom2014</name>
<uri>https://www.youtube.com/channel/UC7vv3cBq14FRXajteZt6FEg</uri>
</author>
<published>2017-09-30T18:44:07+00:00</published>
<updated>2019-01-18T20:11:48+00:00</updated>
<media:group>
<media:title>[EGU] Erstes Offizielles Intro</media:title>
<media:content url="https://www.youtube.com/v/palm1QdV8ZI?version=3" type="application/x-shockwave-flash" width="640" height="390"/>
<media:thumbnail url="https://i1.ytimg.com/vi/palm1QdV8ZI/hqdefault.jpg" width="480" height="360"/>
<media:description>Das erste Intro von Eternal GamerZ United!</media:description>
<media:community>
<media:starRating count="3" average="3.67" min="1" max="5"/>
<media:statistics views="71"/>
</media:community>
</media:group>
</entry>
</feed>';
$result = $this->_xml->parseXml($raw,true);
$this->assertEquals('egucom2014', $result['author']['name']);
}
/*
public function testE107ExportValue()
{
@ -90,12 +137,16 @@
{
}
*/
public function testGetRemoteFile()
{
$feed = 'https://www.youtube.com/feeds/videos.xml?channel_id=UC7vv3cBq14FRXajteZt6FEg';
$contents = $this->_xml->getRemoteFile($feed,true);
$this->assertContains('<?xml version="1.0" encoding="UTF-8"?>',$contents);
}
/*
public function testSetOptForceArray()
{