summaryrefslogtreecommitdiffstats
path: root/tests/OpmlTest.php
diff options
context:
space:
mode:
authorrdalverny <rdalverny@gmail.com>2022-01-24 11:10:02 +0100
committerrdalverny <rdalverny@gmail.com>2022-01-24 11:10:02 +0100
commitd972d625d68c8f86137182ff9a8fb6be5ef271dd (patch)
treef5533ce25181280a1e30ad0d64c26d295475411f /tests/OpmlTest.php
parent94218b1009199a947c58cf88dbb358953249f10c (diff)
downloadplanet-d972d625d68c8f86137182ff9a8fb6be5ef271dd.tar
planet-d972d625d68c8f86137182ff9a8fb6be5ef271dd.tar.gz
planet-d972d625d68c8f86137182ff9a8fb6be5ef271dd.tar.bz2
planet-d972d625d68c8f86137182ff9a8fb6be5ef271dd.tar.xz
planet-d972d625d68c8f86137182ff9a8fb6be5ef271dd.zip
Factor some tests with dataProvideruser/rda/rda-10-dev
Diffstat (limited to 'tests/OpmlTest.php')
-rw-r--r--tests/OpmlTest.php54
1 files changed, 40 insertions, 14 deletions
diff --git a/tests/OpmlTest.php b/tests/OpmlTest.php
index 571fdaf..3da4dc8 100644
--- a/tests/OpmlTest.php
+++ b/tests/OpmlTest.php
@@ -32,22 +32,48 @@ class OpmlManagerTest extends TestCase
];
}
- public function testParse()
+ public function parseProvider()
{
- foreach ($this->fixtures as $data) {
- $given = $data[0];
- $entries = $data[1];
+ return [
+ [file_get_contents('./tests/opml/test-empty.opml'), [], '', '', '', ''],
+ [
+ file_get_contents('./tests/opml/test-valid.opml'),
+ [
+ [
+ 'website' => 'https://blog.example.com/',
+ 'name' => 'text 1',
+ 'feed' => 'https://some.other.example.com/feed/path',
+ 'isDown' => '',
+ ],
+ [
+ 'website' => 'https://blog2.example.com',
+ 'name' => 'text 2',
+ 'feed' => 'https://blog2.example.com/rss.xml',
+ 'isDown' => '',
+ ]
+ ],
+ 'Test OPML',
+ 'user name',
+ 'user@example.com',
+ 'http://user.example.com/'
+ ]
+ ];
+ }
- $opml = new Opml();
- $entries = $opml->parse($given);
+ /**
+ * @dataProvider parseProvider
+ */
+ public function testParse($feedContents, $feeds, $title, $name, $email, $id)
+ {
+ $opml = new Opml();
+ $entries = $opml->parse($feedContents);
- $this->assertEquals($data[1], $entries);
- $this->assertEquals($data[1], $opml->entries);
- $this->assertEquals($data[1], $opml->getPeople());
- $this->assertEquals($data[2], $opml->getTitle());
- $this->assertEquals($data[3], $opml->ownerName);
- $this->assertEquals($data[4], $opml->ownerEmail);
- $this->assertEquals($data[5], $opml->ownerId);
- }
+ $this->assertEquals($feeds, $entries);
+ $this->assertEquals($feeds, $opml->entries);
+ $this->assertEquals($feeds, $opml->getPeople());
+ $this->assertEquals($title, $opml->getTitle());
+ $this->assertEquals($name, $opml->ownerName);
+ $this->assertEquals($email, $opml->ownerEmail);
+ $this->assertEquals($id, $opml->ownerId);
}
}