From 779a63183354987d3b453c8492d92b17f127b8b3 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 31 May 2023 12:55:04 +0000 Subject: [PATCH] Bug 33871: Test where parameter in Sitemapper.t Content-Type: text/plain; charset=utf-8 This makes it possible to remove the ugly global deletes at the start. Test plan: Run t/db_dependent/Sitemapper.t Signed-off-by: Marcel de Rooy --- t/db_dependent/Sitemapper.t | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/t/db_dependent/Sitemapper.t b/t/db_dependent/Sitemapper.t index f62c71fbe1..d835b39dea 100755 --- a/t/db_dependent/Sitemapper.t +++ b/t/db_dependent/Sitemapper.t @@ -30,8 +30,6 @@ use t::lib::Mocks; use Koha::Database; use Koha::DateUtils qw( dt_from_string ); -use Koha::Biblios; -use Koha::Checkouts; use Koha::Sitemapper; use Koha::Sitemapper::Writer; @@ -44,9 +42,6 @@ subtest 'Sitemapper' => sub { my $now = dt_from_string()->ymd; - # FIXME Would be nice to remove both deletes again - Koha::Checkouts->delete; - Koha::Biblios->delete; my $biblio1 = $builder->build_sample_biblio; $biblio1->set({ datecreated => '2013-11-15', timestamp => '2013-11-15' })->store; my $id1 = $biblio1->id; @@ -63,7 +58,7 @@ subtest 'Sitemapper' => sub { dir => $dir, short => 0, ); - $sitemapper->run(); + $sitemapper->run( "biblionumber>=$id1" ); my $file = "$dir/sitemapindex.xml"; ok( -e "$dir/sitemapindex.xml", 'File sitemapindex.xml created' ); @@ -108,7 +103,7 @@ EOS dir => $dir, short => 1, ); - $sitemapper->run(); + $sitemapper->run( "biblionumber>=$id1" ); $file = "$dir/sitemap0001.xml"; ok( -e $file, 'File sitemap0001.xml with short URLs created' ); @@ -129,10 +124,10 @@ EOS EOS is( $file_content, $expected_content, 'Its content is valid' ); - # No need to create 75000 biblios here. Let's create 10 with $MAX == 6. - # Expecting 3 files: index plus 2 url files with 6 and 4 urls. + # No need to create 75000 biblios here. Let's create 10 more with $MAX == 6. + # Expecting 3 files: index plus 2 url files with 6 and 4 urls (when we start after biblio2). $Koha::Sitemapper::Writer::MAX = 6; - for my $count ( 3..10 ) { + for my $count ( 0..9 ) { my $biblio2 = $builder->build_sample_biblio->set({ datecreated => '2015-08-31', timestamp => '2015-08-31' })->store; } @@ -142,7 +137,7 @@ EOS dir => $dir, short => 1, ); - $sitemapper->run(); + $sitemapper->run( "biblionumber>$id2" ); # Note: new filter $file = "$dir/sitemapindex.xml"; ok( -e "$dir/sitemapindex.xml", 'File sitemapindex.xml for 10 bibs created' ); -- 2.30.2