From 88e20a45ccb792f9fbe9b46c1823d4e92f81291a Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Thu, 22 Oct 2015 08:52:33 -0400 Subject: [PATCH] [PASSED QA] Bug 14248: Regression tests requested TEST PLAN --------- 1) apply patch 2) prove -v t/db_dependent/NewsChannels.t 3) run koha qa test tools. Signed-off-by: Martin Persson Signed-off-by: Katrin Fischer --- t/db_dependent/NewsChannels.t | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/NewsChannels.t b/t/db_dependent/NewsChannels.t index 3818dac..1928b46 100644 --- a/t/db_dependent/NewsChannels.t +++ b/t/db_dependent/NewsChannels.t @@ -3,7 +3,7 @@ use Modern::Perl; use C4::Dates qw(format_date); use C4::Branch qw(GetBranchName); -use Test::More tests => 11; +use Test::More tests => 12; BEGIN { use_ok('C4::NewsChannels'); @@ -178,4 +178,35 @@ ok( $opac_news_count >= 2, 'Successfully tested get_opac_news for LIB1!' ); ( $opac_news_count, $arrayref_opac_news ) = GetNewsToDisplay( q{}, 'LIB1' ); ok( $opac_news_count >= 2, 'Successfully tested GetNewsToDisplay for LIB1!' ); +# Regression test 14248 -- make sure author_title, author_firstname, and +# author_surname exist. + +subtest 'Regression tests on author title, firstname, and surname.', sub { + my ( $opac_news_count, $opac_news ) = get_opac_news( 0, q{}, 'LIB1' ); + my $check = 0; # bitwise flag to confirm NULL and not NULL borrowernumber. + ok($opac_news_count>0,'Data exists for regression testing'); + foreach my $news_item (@$opac_news) { + ok(exists $news_item->{author_title}, 'Author title exists'); + ok(exists $news_item->{author_firstname},'Author first name exists'); + ok(exists $news_item->{author_surname}, 'Author surname exists'); + if ($news_item->{borrowernumber}) { + ok(defined $news_item->{author_title} || + defined $news_item->{author_firstname} || + defined $news_item->{author_surname}, 'Author data defined'); + $check = $check | 2; # bitwise flag; + } + else { + ok(!defined $news_item->{author_title}, + 'Author title undefined as expected'); + ok(!defined $news_item->{author_firstname}, + 'Author first name undefined as expected'); + ok(!defined $news_item->{author_surname}, + 'Author surname undefined as expected'); + $check = $check | 1; # bitwise flag; + } + } + ok($check==3,'Both with and without author data tested'); + done_testing(); +}; + $dbh->rollback; -- 1.9.1