Lines 30-37
use t::lib::Mocks;
Link Here
|
30 |
|
30 |
|
31 |
use Koha::Database; |
31 |
use Koha::Database; |
32 |
use Koha::DateUtils qw( dt_from_string ); |
32 |
use Koha::DateUtils qw( dt_from_string ); |
33 |
use Koha::Biblios; |
|
|
34 |
use Koha::Checkouts; |
35 |
use Koha::Sitemapper; |
33 |
use Koha::Sitemapper; |
36 |
use Koha::Sitemapper::Writer; |
34 |
use Koha::Sitemapper::Writer; |
37 |
|
35 |
|
Lines 44-52
subtest 'Sitemapper' => sub {
Link Here
|
44 |
|
42 |
|
45 |
my $now = dt_from_string()->ymd; |
43 |
my $now = dt_from_string()->ymd; |
46 |
|
44 |
|
47 |
# FIXME Would be nice to remove both deletes again |
|
|
48 |
Koha::Checkouts->delete; |
49 |
Koha::Biblios->delete; |
50 |
my $biblio1 = $builder->build_sample_biblio; |
45 |
my $biblio1 = $builder->build_sample_biblio; |
51 |
$biblio1->set({ datecreated => '2013-11-15', timestamp => '2013-11-15' })->store; |
46 |
$biblio1->set({ datecreated => '2013-11-15', timestamp => '2013-11-15' })->store; |
52 |
my $id1 = $biblio1->id; |
47 |
my $id1 = $biblio1->id; |
Lines 63-69
subtest 'Sitemapper' => sub {
Link Here
|
63 |
dir => $dir, |
58 |
dir => $dir, |
64 |
short => 0, |
59 |
short => 0, |
65 |
); |
60 |
); |
66 |
$sitemapper->run(); |
61 |
$sitemapper->run( "biblionumber>=$id1" ); |
67 |
|
62 |
|
68 |
my $file = "$dir/sitemapindex.xml"; |
63 |
my $file = "$dir/sitemapindex.xml"; |
69 |
ok( -e "$dir/sitemapindex.xml", 'File sitemapindex.xml created' ); |
64 |
ok( -e "$dir/sitemapindex.xml", 'File sitemapindex.xml created' ); |
Lines 108-114
EOS
Link Here
|
108 |
dir => $dir, |
103 |
dir => $dir, |
109 |
short => 1, |
104 |
short => 1, |
110 |
); |
105 |
); |
111 |
$sitemapper->run(); |
106 |
$sitemapper->run( "biblionumber>=$id1" ); |
112 |
|
107 |
|
113 |
$file = "$dir/sitemap0001.xml"; |
108 |
$file = "$dir/sitemap0001.xml"; |
114 |
ok( -e $file, 'File sitemap0001.xml with short URLs created' ); |
109 |
ok( -e $file, 'File sitemap0001.xml with short URLs created' ); |
Lines 129-138
EOS
Link Here
|
129 |
EOS |
124 |
EOS |
130 |
is( $file_content, $expected_content, 'Its content is valid' ); |
125 |
is( $file_content, $expected_content, 'Its content is valid' ); |
131 |
|
126 |
|
132 |
# No need to create 75000 biblios here. Let's create 10 with $MAX == 6. |
127 |
# No need to create 75000 biblios here. Let's create 10 more with $MAX == 6. |
133 |
# Expecting 3 files: index plus 2 url files with 6 and 4 urls. |
128 |
# Expecting 3 files: index plus 2 url files with 6 and 4 urls (when we start after biblio2). |
134 |
$Koha::Sitemapper::Writer::MAX = 6; |
129 |
$Koha::Sitemapper::Writer::MAX = 6; |
135 |
for my $count ( 3..10 ) { |
130 |
for my $count ( 0..9 ) { |
136 |
my $biblio2 = $builder->build_sample_biblio->set({ datecreated => '2015-08-31', timestamp => '2015-08-31' })->store; |
131 |
my $biblio2 = $builder->build_sample_biblio->set({ datecreated => '2015-08-31', timestamp => '2015-08-31' })->store; |
137 |
} |
132 |
} |
138 |
|
133 |
|
Lines 142-148
EOS
Link Here
|
142 |
dir => $dir, |
137 |
dir => $dir, |
143 |
short => 1, |
138 |
short => 1, |
144 |
); |
139 |
); |
145 |
$sitemapper->run(); |
140 |
$sitemapper->run( "biblionumber>$id2" ); # Note: new filter |
146 |
|
141 |
|
147 |
$file = "$dir/sitemapindex.xml"; |
142 |
$file = "$dir/sitemapindex.xml"; |
148 |
ok( -e "$dir/sitemapindex.xml", 'File sitemapindex.xml for 10 bibs created' ); |
143 |
ok( -e "$dir/sitemapindex.xml", 'File sitemapindex.xml for 10 bibs created' ); |
149 |
- |
|
|