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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
|
#!/usr/bin/perl
use lib qw (../lib lib);
use Test::More 'no_plan';
use strict;
use warnings;
use MKDoc::XML::Dumper;
use Data::Dumper;
{
my $xml = <<EOF;
<perl>
<hash id="id_151027208" bless="flo::editor::File">
<item key="file">8763623178/search.html</item>
<item key="title">search</item>
<item key="uri_name">search.html</item>
</hash>
</perl>
EOF
my $struct = MKDoc::XML::Dumper->xml2perl ($xml);
is (ref $struct, 'flo::editor::File');
is ($struct->{file}, '8763623178/search.html');
is ($struct->{title}, 'search');
is ($struct->{uri_name}, 'search.html');
}
{
my $xml = <<EOF;
<perl>
<hash id="id_151020264" bless="flo::editor::Headlines">
<item key="from_path">/</item>
<item key="leaf_only">on</item>
<item key="max_headlines">12</item>
<item key="title">hello</item>
<item key="uri_name">hello.html</item>
</hash>
</perl>
EOF
my $struct = MKDoc::XML::Dumper->xml2perl ($xml);
is (ref $struct, 'flo::editor::Headlines');
is ($struct->{from_path}, '/');
is ($struct->{leaf_only}, 'on');
is ($struct->{max_headlines}, '12');
is ($struct->{title}, 'hello');
is ($struct->{uri_name}, 'hello.html');
}
{
my $xml = <<EOF;
<perl>
<hash id="id_151013220" bless="flo::editor::Image">
<item key="image">7898392326/aureli-julian.jif</item>
<item key="title">Aureli Julian</item>
<item key="uri_name">aureli-julian.jif</item>
</hash>
</perl>
EOF
my $struct = MKDoc::XML::Dumper->xml2perl ($xml);
is (ref $struct, 'flo::editor::Image');
is ($struct->{image}, '7898392326/aureli-julian.jif');
is ($struct->{title}, 'Aureli Julian');
is ($struct->{uri_name}, 'aureli-julian.jif');
}
{
my $xml = <<EOF;
<perl>
<hash id="id_151013556" bless="flo::editor::Link">
<item key="description">foo</item>
<item key="title">foo</item>
<item key="uri_name">foo.link</item>
<item key="url">http://www.foo.com</item>
</hash>
</perl>
EOF
my $struct = MKDoc::XML::Dumper->xml2perl ($xml);
is (ref $struct, 'flo::editor::Link');
is ($struct->{description}, 'foo');
is ($struct->{title}, 'foo');
is ($struct->{uri_name}, 'foo.link');
is ($struct->{url}, 'http://www.foo.com');
}
{
my $xml = <<EOF;
<perl>
<hash id="id_151013856" bless="flo::editor::Photo">
<item key="alt">Aureli Julian</item>
<item key="coverage"></item>
<item key="creator">Fred Flintstone</item>
<item key="date_created">2003-11-05</item>
<item key="description">foo</item>
<item key="image">0322940468/aureli-julian.jif</item>
<item key="rights"></item>
<item key="uri_name">aureli-julian-2.jif</item>
</hash>
</perl>
EOF
my $struct = MKDoc::XML::Dumper->xml2perl ($xml);
is (ref $struct, 'flo::editor::Photo');
is ($struct->{'alt'}, 'Aureli Julian');
is ($struct->{'coverage'}, '');
is ($struct->{'creator'}, 'Fred Flintstone');
is ($struct->{'date_created'}, '2003-11-05');
is ($struct->{'description'}, 'foo');
is ($struct->{'image'}, '0322940468/aureli-julian.jif');
is ($struct->{'rights'}, '');
is ($struct->{'uri_name'}, 'aureli-julian-2.jif');
}
{
my $xml = <<EOF;
<perl>
<hash id="id_151013616" bless="flo::editor::Poll">
<item key="answer1">foo</item>
<item key="answer2">bar</item>
<item key="answer3"></item>
<item key="answer4"></item>
<item key="answer5"></item>
<item key="answer6"></item>
<item key="answer7"></item>
<item key="answer8"></item>
<item key="answer9"></item>
<item key="date_start">2003-11-05</item>
<item key="date_stop">2003-11-07</item>
<item key="hour_start">00</item>
<item key="hour_stop">00</item>
<item key="id">HWNJQUNGJB</item>
<item key="question">woot?</item>
<item key="uri_name">poll.html</item>
</hash>
</perl>
EOF
my $struct = MKDoc::XML::Dumper->xml2perl ($xml);
is (ref $struct, 'flo::editor::Poll');
is ($struct->{'answer1'}, 'foo');
is ($struct->{'answer2'}, 'bar');
is ($struct->{'answer3'}, '');
is ($struct->{'answer4'}, '');
is ($struct->{'answer5'}, '');
is ($struct->{'answer6'}, '');
is ($struct->{'answer7'}, '');
is ($struct->{'answer8'}, '');
is ($struct->{'answer9'}, '');
is ($struct->{'date_start'}, '2003-11-05');
is ($struct->{'date_stop'}, '2003-11-07');
is ($struct->{'hour_start'}, '00');
is ($struct->{'hour_stop'}, '00');
is ($struct->{'id'}, 'HWNJQUNGJB');
is ($struct->{'question'}, 'woot?');
is ($struct->{'uri_name'}, 'poll.html');
}
{
my $xml = <<EOF;
<perl>
<hash id="id_151036892" bless="flo::editor::RSS">
<item key="max">all</item>
<item key="template">bulleted_list</item>
<item key="title">foo</item>
<item key="uri">http://www.foo.com/somerss</item>
<item key="uri_name">rss.rss</item>
</hash>
</perl>
EOF
my $struct = MKDoc::XML::Dumper->xml2perl ($xml);
is (ref $struct, 'flo::editor::RSS');
is ($struct->{'max'}, 'all');
is ($struct->{'template'}, 'bulleted_list');
is ($struct->{'title'}, 'foo');
is ($struct->{'uri'}, 'http://www.foo.com/somerss');
is ($struct->{'uri_name'}, 'rss.rss');
}
{
my $xml = <<EOF;
<perl>
<hash id="id_151018396" bless="flo::editor::Text">
<item key="data">gsdfgsdfgds</item>
<item key="uri_name">text.txt</item>
</hash>
</perl>
EOF
my $struct = MKDoc::XML::Dumper->xml2perl ($xml);
is (ref $struct, 'flo::editor::Text');
is ($struct->{'data'}, 'gsdfgsdfgds');
is ($struct->{'uri_name'}, 'text.txt');
}
{
my $xml = <<EOF;
<?xml version="1.0" encoding="UTF-8"?>
<perl>
<hash id="id_144488596" bless="flo::editor::Photo">
<item key="alt">Xchange Learning Centre</item>
<item key="class">photo</item>
<item key="coverage">Northamptonshire, UK</item>
<item key="created_day">18</item>
<item key="created_month">03</item>
<item key="created_year">2002</item>
<item key="creator">David Matthews</item>
<item key="description">Photo taken outside the The Xchange Learning Centre, Kettering.</item>
<item key="image">8217988573/xchange-learning-centre.jpg</item>
<item key="param_name">_edit_block_32_photo</item>
<item key="rights">© Crown copyright 2003</item>
</hash>
</perl>
EOF
ok (ref MKDoc::XML::Dumper->xml2perl ($xml));
}
__END__
|