Commit | Line | Data |
89495df9 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More tests => 14; |
5 | |
6 | use XML::Feed; |
7 | use File::Spec; |
8 | |
9 | |
10 | { |
11 | my $rss = XML::Feed->parse( |
12 | File::Spec->catfile(File::Spec->curdir(), |
13 | "t", "samples", "rss10-double2.xml" |
14 | ) |
15 | ); |
16 | |
17 | # TEST |
18 | isa_ok($rss, 'XML::Feed::Format::RSS'); |
19 | my $rss_entry = ($rss->entries)[0]; |
20 | |
21 | # TEST |
22 | isa_ok($rss_entry, 'XML::Feed::Entry::Format::RSS'); |
23 | |
24 | |
25 | my $rss_content = $rss_entry->content; |
26 | |
27 | # TEST |
28 | isa_ok($rss_content, 'XML::Feed::Content'); |
29 | |
30 | # TEST |
31 | is($rss_content->type, 'text/html', 'Correct content type'); |
32 | |
33 | # TEST |
34 | like($rss_content->body, qr(<|<), 'Contains HTML tags'); |
35 | |
36 | # TEST |
37 | like($rss_content->body, |
38 | qr{\Q<img src="http://s.ph-cdn.com/newman/gfx/news/2011/3-neuroscienti.jpg" width="300" class="articleImage" />}, |
39 | 'Contains HTML tags'); |
40 | |
41 | unlike($rss->as_xml, qr{&lt;}, 'No double encoding'); |
42 | |
43 | my $atom = $rss->convert('Atom'); |
44 | |
45 | # TEST |
46 | isa_ok($atom, 'XML::Feed::Format::Atom'); |
47 | |
48 | my $atom_entry = ($atom->entries)[0]; |
49 | |
50 | # TEST |
51 | isa_ok($atom_entry, 'XML::Feed::Entry::Format::Atom'); |
52 | |
53 | my $atom_content = $atom_entry->content; |
54 | |
55 | # TEST |
56 | isa_ok($atom_content, 'XML::Feed::Content'); |
57 | |
58 | # TEST |
59 | is($atom_content->type, 'text/html', 'Correct content type'); |
60 | |
61 | # TEST |
62 | like($atom_content->body, qr(<|<), 'Contains HTML tags'); |
63 | |
64 | # TEST |
65 | like($atom_content->body, |
66 | qr{\Q<img src="http://s.ph-cdn.com/newman/gfx/news/2011/3-neuroscienti.jpg" width="300" class="articleImage" />}, |
67 | 'Contains HTML tags'); |
68 | |
89495df9 |
69 | unlike($atom->as_xml, qr{&lt;}, 'No double encoding'); |
70 | } |
71 | |