|
Lines 3-9
Link Here
|
| 3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
| 4 |
use C4::Dates qw(format_date); |
4 |
use C4::Dates qw(format_date); |
| 5 |
use C4::Branch qw(GetBranchName); |
5 |
use C4::Branch qw(GetBranchName); |
| 6 |
use Test::More tests => 11; |
6 |
use Test::More tests => 12; |
| 7 |
|
7 |
|
| 8 |
BEGIN { |
8 |
BEGIN { |
| 9 |
use_ok('C4::NewsChannels'); |
9 |
use_ok('C4::NewsChannels'); |
|
Lines 178-181
ok( $opac_news_count >= 2, 'Successfully tested get_opac_news for LIB1!' );
Link Here
|
| 178 |
( $opac_news_count, $arrayref_opac_news ) = GetNewsToDisplay( q{}, 'LIB1' ); |
178 |
( $opac_news_count, $arrayref_opac_news ) = GetNewsToDisplay( q{}, 'LIB1' ); |
| 179 |
ok( $opac_news_count >= 2, 'Successfully tested GetNewsToDisplay for LIB1!' ); |
179 |
ok( $opac_news_count >= 2, 'Successfully tested GetNewsToDisplay for LIB1!' ); |
| 180 |
|
180 |
|
|
|
181 |
# Regression test 14248 -- make sure author_title, author_firstname, and |
| 182 |
# author_surname exist. |
| 183 |
|
| 184 |
subtest 'Regression tests on author title, firstname, and surname.', sub { |
| 185 |
my ( $opac_news_count, $opac_news ) = get_opac_news( 0, q{}, 'LIB1' ); |
| 186 |
my $check = 0; # bitwise flag to confirm NULL and not NULL borrowernumber. |
| 187 |
ok($opac_news_count>0,'Data exists for regression testing'); |
| 188 |
foreach my $news_item (@$opac_news) { |
| 189 |
ok(exists $news_item->{author_title}, 'Author title exists'); |
| 190 |
ok(exists $news_item->{author_firstname},'Author first name exists'); |
| 191 |
ok(exists $news_item->{author_surname}, 'Author surname exists'); |
| 192 |
if ($news_item->{borrowernumber}) { |
| 193 |
ok(defined $news_item->{author_title} || |
| 194 |
defined $news_item->{author_firstname} || |
| 195 |
defined $news_item->{author_surname}, 'Author data defined'); |
| 196 |
$check = $check | 2; # bitwise flag; |
| 197 |
} |
| 198 |
else { |
| 199 |
ok(!defined $news_item->{author_title}, |
| 200 |
'Author title undefined as expected'); |
| 201 |
ok(!defined $news_item->{author_firstname}, |
| 202 |
'Author first name undefined as expected'); |
| 203 |
ok(!defined $news_item->{author_surname}, |
| 204 |
'Author surname undefined as expected'); |
| 205 |
$check = $check | 1; # bitwise flag; |
| 206 |
} |
| 207 |
} |
| 208 |
ok($check==3,'Both with and without author data tested'); |
| 209 |
done_testing(); |
| 210 |
}; |
| 211 |
|
| 181 |
$dbh->rollback; |
212 |
$dbh->rollback; |
| 182 |
- |
|
|