1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
<?php
use PHPUnit\Framework\TestCase;
class OpmlManagerTest extends TestCase
{
public function setUp() : void
{
$this->fixtures = [
[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/'
]
];
}
public function parseProvider()
{
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/'
]
];
}
/**
* @dataProvider parseProvider
*/
public function testParse($feedContents, $feeds, $title, $name, $email, $id)
{
$opml = new Opml();
$entries = $opml->parse($feedContents);
$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);
}
}
|