Lines 68-74
subtest 'Sitemapper' => sub {
Link Here
|
68 |
|
68 |
|
69 |
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
69 |
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
70 |
<sitemap> |
70 |
<sitemap> |
71 |
<loc>http://www.mylibrary.org/sitemap0001.xml</loc> |
71 |
<loc>http://www.mylibrary.org/sitemap_0001.xml</loc> |
72 |
<lastmod>$now</lastmod> |
72 |
<lastmod>$now</lastmod> |
73 |
</sitemap> |
73 |
</sitemap> |
74 |
</sitemapindex> |
74 |
</sitemapindex> |
Lines 76-83
EOS
Link Here
|
76 |
chop $expected_content; |
76 |
chop $expected_content; |
77 |
is( $file_content, $expected_content, 'Its content is valid' ); |
77 |
is( $file_content, $expected_content, 'Its content is valid' ); |
78 |
|
78 |
|
79 |
$file = "$dir/sitemap0001.xml"; |
79 |
$file = "$dir/sitemap_0001.xml"; |
80 |
ok( -e $file, 'File sitemap0001.xml created' ); |
80 |
ok( -e $file, 'File sitemap_0001.xml created' ); |
81 |
$file_content = read_file($file); |
81 |
$file_content = read_file($file); |
82 |
$expected_content = <<"EOS"; |
82 |
$expected_content = <<"EOS"; |
83 |
<?xml version="1.0" encoding="UTF-8"?> |
83 |
<?xml version="1.0" encoding="UTF-8"?> |
Lines 105-112
EOS
Link Here
|
105 |
); |
105 |
); |
106 |
$sitemapper->run( "biblionumber>=$id1" ); |
106 |
$sitemapper->run( "biblionumber>=$id1" ); |
107 |
|
107 |
|
108 |
$file = "$dir/sitemap0001.xml"; |
108 |
$file = "$dir/sitemap_0001.xml"; |
109 |
ok( -e $file, 'File sitemap0001.xml with short URLs created' ); |
109 |
ok( -e $file, 'File sitemap_0001.xml with short URLs created' ); |
110 |
$file_content = read_file($file); |
110 |
$file_content = read_file($file); |
111 |
$expected_content = <<"EOS"; |
111 |
$expected_content = <<"EOS"; |
112 |
<?xml version="1.0" encoding="UTF-8"?> |
112 |
<?xml version="1.0" encoding="UTF-8"?> |
Lines 147-157
EOS
Link Here
|
147 |
|
147 |
|
148 |
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
148 |
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
149 |
<sitemap> |
149 |
<sitemap> |
150 |
<loc>http://www.mylibrary.org/sitemap0001.xml</loc> |
150 |
<loc>http://www.mylibrary.org/sitemap_0001.xml</loc> |
151 |
<lastmod>$now</lastmod> |
151 |
<lastmod>$now</lastmod> |
152 |
</sitemap> |
152 |
</sitemap> |
153 |
<sitemap> |
153 |
<sitemap> |
154 |
<loc>http://www.mylibrary.org/sitemap0002.xml</loc> |
154 |
<loc>http://www.mylibrary.org/sitemap_0002.xml</loc> |
155 |
<lastmod>$now</lastmod> |
155 |
<lastmod>$now</lastmod> |
156 |
</sitemap> |
156 |
</sitemap> |
157 |
</sitemapindex> |
157 |
</sitemapindex> |
Lines 159-166
EOS
Link Here
|
159 |
chop $expected_content; |
159 |
chop $expected_content; |
160 |
is( $file_content, $expected_content, 'Its content is valid' ); |
160 |
is( $file_content, $expected_content, 'Its content is valid' ); |
161 |
|
161 |
|
162 |
$file = "$dir/sitemap0001.xml"; |
162 |
$file = "$dir/sitemap_0001.xml"; |
163 |
ok( -e $file, 'File sitemap0001.xml created' ); |
163 |
ok( -e $file, 'File sitemap_0001.xml created' ); |
164 |
|
164 |
|
165 |
open my $fh, '<', $file or croak; |
165 |
open my $fh, '<', $file or croak; |
166 |
my $count = 0; |
166 |
my $count = 0; |
Lines 170-177
EOS
Link Here
|
170 |
close $fh; |
170 |
close $fh; |
171 |
is( $count, 6, 'It contains 6 URLs' ); |
171 |
is( $count, 6, 'It contains 6 URLs' ); |
172 |
|
172 |
|
173 |
$file = "$dir/sitemap0002.xml"; |
173 |
$file = "$dir/sitemap_0002.xml"; |
174 |
ok( -e $file, 'File sitemap0002.xml created' ); |
174 |
ok( -e $file, 'File sitemap_0002.xml created' ); |
175 |
|
175 |
|
176 |
open $fh, '<', $file or croak; |
176 |
open $fh, '<', $file or croak; |
177 |
$count = 0; |
177 |
$count = 0; |
Lines 182-188
EOS
Link Here
|
182 |
is( $count, 4, 'It contains 4 URLs' ); |
182 |
is( $count, 4, 'It contains 4 URLs' ); |
183 |
|
183 |
|
184 |
# Cleanup |
184 |
# Cleanup |
185 |
for my $file (qw/sitemapindex.xml sitemap0001.xml sitemap0002.xml/) { |
185 |
for my $file (qw/sitemapindex.xml sitemap_0001.xml sitemap_0002.xml/) { |
186 |
unlink "$dir/$file"; |
186 |
unlink "$dir/$file"; |
187 |
} |
187 |
} |
188 |
}; |
188 |
}; |
189 |
- |
|
|