From 38cd0a49e423cdfc9261e89bea03b4829b90b808 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 19 Dec 2017 14:54:50 -0500 Subject: [PATCH] Bug 17770: Perltidy differences should only be whitespace --- t/db_dependent/Sitemapper.t | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/t/db_dependent/Sitemapper.t b/t/db_dependent/Sitemapper.t index 2f07dfa..450b9e9 100755 --- a/t/db_dependent/Sitemapper.t +++ b/t/db_dependent/Sitemapper.t @@ -34,12 +34,9 @@ use_ok('Koha::Sitemapper'); use_ok('Koha::Sitemapper::Writer'); sub fixtures { - my ( $data ) = @_; + my ($data) = @_; fixtures_ok [ - Biblio => [ - [ qw/ biblionumber datecreated timestamp / ], - @{$data}, - ], + Biblio => [ [qw/ biblionumber datecreated timestamp /], @{$data}, ], ], 'add fixtures'; return; } @@ -47,6 +44,7 @@ sub fixtures { # Make the code in the module use our mocked Koha::Schema/Koha::Database my $db = Test::MockModule->new('Koha::Database'); $db->mock( + # Schema() gives us the DB connection set up by Test::DBIx::Class _new_schema => sub { return Schema(); } ); @@ -54,8 +52,8 @@ $db->mock( my $dir = File::Spec->tmpdir(); my $data = [ - [ qw/ 1 2013-11-15 2013-11-15/ ], - [ qw/ 2 2015-08-31 2015-08-31/ ], + [qw/ 1 2013-11-15 2013-11-15/], + [qw/ 2 2015-08-31 2015-08-31/], ]; fixtures($data); @@ -69,9 +67,9 @@ my $sitemapper = Koha::Sitemapper->new( $sitemapper->run(); my $file = "$dir/sitemapindex.xml"; -ok( -e "$dir/sitemapindex.xml", 'File sitemapindex.xml created'); -my $file_content = read_file($file); -my $now = DateTime->now->ymd; +ok( -e "$dir/sitemapindex.xml", 'File sitemapindex.xml created' ); +my $file_content = read_file($file); +my $now = DateTime->now->ymd; my $expected_content = <<"EOS"; @@ -86,8 +84,8 @@ chop $expected_content; is( $file_content, $expected_content, 'Its content is valid' ); $file = "$dir/sitemap0001.xml"; -ok( -e $file, 'File sitemap0001.xml created'); -$file_content = read_file($file); +ok( -e $file, 'File sitemap0001.xml created' ); +$file_content = read_file($file); $expected_content = <<"EOS"; @@ -104,7 +102,6 @@ $expected_content = <<"EOS"; EOS is( $file_content, $expected_content, 'Its content is valid' ); - # Create a sitemap for a catalog containg 2 biblios, with option 'short url'. # Test that 2 files are created. $sitemapper = Koha::Sitemapper->new( @@ -116,8 +113,8 @@ $sitemapper = Koha::Sitemapper->new( $sitemapper->run(); $file = "$dir/sitemap0001.xml"; -ok( -e $file, 'File sitemap0001.xml with short URLs created'); -$file_content = read_file($file); +ok( -e $file, 'File sitemap0001.xml with short URLs created' ); +$file_content = read_file($file); $expected_content = <<"EOS"; @@ -138,8 +135,8 @@ is( $file_content, $expected_content, 'Its content is valid' ); # url'. Test that 3 files are created: index file + 2 urls file with # respectively 50000 et 25000 urls. $data = []; -for my $count (3..75_000) { - push @{$data}, [ $count, '2015-08-31', '2015-08-31']; +for my $count ( 3 .. 75_000 ) { + push @{$data}, [ $count, '2015-08-31', '2015-08-31' ]; } fixtures($data); $sitemapper = Koha::Sitemapper->new( @@ -151,8 +148,9 @@ $sitemapper = Koha::Sitemapper->new( $sitemapper->run(); $file = "$dir/sitemapindex.xml"; -ok( -e "$dir/sitemapindex.xml", 'File sitemapindex.xml for 75000 bibs created'); -$file_content = read_file($file); +ok( -e "$dir/sitemapindex.xml", + 'File sitemapindex.xml for 75000 bibs created' ); +$file_content = read_file($file); $expected_content = <<"EOS"; @@ -171,7 +169,7 @@ chop $expected_content; is( $file_content, $expected_content, 'Its content is valid' ); $file = "$dir/sitemap0001.xml"; -ok( -e $file, 'File sitemap0001.xml created'); +ok( -e $file, 'File sitemap0001.xml created' ); open my $fh, '<', $file or croak; my $count = 0; @@ -179,10 +177,10 @@ while (<$fh>) { if (//xsm) { $count++; } } close $fh or carp "Failed to close $file well."; -is( $count, 50_000, 'It contains 50000 URLs'); +is( $count, 50_000, 'It contains 50000 URLs' ); $file = "$dir/sitemap0002.xml"; -ok( -e $file, 'File sitemap0002.xml created'); +ok( -e $file, 'File sitemap0002.xml created' ); open $fh, '<', $file or croak; $count = 0; @@ -190,7 +188,7 @@ while (<$fh>) { if (//xsm) { $count++; } } close $fh or carp "Failed to close $file well."; -is( $count, 25_000, 'It contains 25000 URLs'); +is( $count, 25_000, 'It contains 25000 URLs' ); # Cleanup for my $file (qw/sitemapindex.xml sitemap0001.xml sitemap0002.xml/) { -- 2.1.4