J. King
4 years ago
7 changed files with 62 additions and 1 deletions
@ -0,0 +1,30 @@ |
|||
<?php |
|||
/** @license MIT |
|||
* Copyright 2018 J. King |
|||
* See LICENSE and AUTHORS files for details */ |
|||
|
|||
declare(strict_types=1); |
|||
namespace MensBeam\Lax\TestCase\XML; |
|||
|
|||
/** |
|||
* @covers MensBeam\Lax\Parser\Construct<extended> |
|||
* @covers MensBeam\Lax\Parser\XML\Feed<extended> |
|||
* @covers MensBeam\Lax\Parser\XML\Entry<extended> |
|||
*/ |
|||
class XMLTest extends \MensBeam\Lax\TestCase\AbstractParserTestCase { |
|||
/** @dataProvider provideXML */ |
|||
public function testParseAnXmlFeed(string $input, string $type, ?string $url, $exp): void { |
|||
$p = new \MensBeam\Lax\Parser\XML\Feed($input, $type, $url); |
|||
if ($exp instanceof \Exception) { |
|||
$this->expectExceptionObject($exp); |
|||
$p->parse(); |
|||
} else { |
|||
$act = $p->parse(); |
|||
$this->assertEquals($exp, $act); |
|||
} |
|||
} |
|||
|
|||
public function provideXML(): iterable { |
|||
return $this->provideParserTests(__DIR__."/*.yaml"); |
|||
} |
|||
} |
@ -0,0 +1,6 @@ |
|||
Minimal Atom feed: |
|||
input: > |
|||
<feed xmlns="http://www.w3.org/2005/Atom"/> |
|||
output: |
|||
format: atom |
|||
version: '1.0' |
@ -0,0 +1,8 @@ |
|||
Minimal RSS 0.90 feed: |
|||
input : > |
|||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/"> |
|||
<channel/> |
|||
</rdf:RDF> |
|||
output: |
|||
format: rdf |
|||
version: '0.90' |
@ -0,0 +1,8 @@ |
|||
Minimal RSS 1.0 feed: |
|||
input : > |
|||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/"> |
|||
<channel/> |
|||
</rdf:RDF> |
|||
output: |
|||
format: rdf |
|||
version: '1.0' |
@ -0,0 +1,6 @@ |
|||
Minimal RSS 1.0 feed: |
|||
input : > |
|||
<rss version="2.0"/> |
|||
output: |
|||
format: rss |
|||
version: '2.0' |
Loading…
Reference in new issue