Bug 30781: Add unit test for substitute with undefined value
Add unit test that generates warn. This may be usefull as no regression test. Run prove t/db_dependent/Letters.t You see warn : t/db_dependent/Letters.t .. 1/84 Use of uninitialized value $val in substitution iterator at /kohadevbox/koha/C4/Letters.pm line 607. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
e536229292
commit
2e0243c378
1 changed files with 15 additions and 1 deletions
|
@ -18,7 +18,7 @@
|
|||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::More tests => 83;
|
||||
use Test::More tests => 85;
|
||||
use Test::MockModule;
|
||||
use Test::Warn;
|
||||
use Test::Exception;
|
||||
|
@ -279,6 +279,20 @@ $prepared_letter = GetPreparedLetter((
|
|||
$my_content_letter = qq|This is a SMS for an $substitute->{status}|;
|
||||
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' );
|
||||
|
||||
warning_is {
|
||||
$prepared_letter = GetPreparedLetter((
|
||||
module => 'my module',
|
||||
branchcode => $library->{branchcode},
|
||||
letter_code => 'my code',
|
||||
tables => $tables,
|
||||
substitute => { status => undef },
|
||||
repeat => $repeat,
|
||||
message_transport_type => 'sms',
|
||||
));
|
||||
}
|
||||
undef, "No warning if GetPreparedLetter called with substitute containing undefined value";
|
||||
is( $prepared_letter->{content}, q|This is a SMS for an |, 'GetPreparedLetter returns the content correctly when substitute contains undefined value' );
|
||||
|
||||
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('test_date','TEST_DATE','Test dates','A title with a timestamp: <<biblio.timestamp>>','This one only contains the date: <<biblio.timestamp | dateonly>>.');});
|
||||
$prepared_letter = GetPreparedLetter((
|
||||
module => 'test_date',
|
||||
|
|
Loading…
Reference in a new issue