On bug 29697, an explicit call to 'warn' was added, but no tests were
added for that behavior.
This patch adds that.
To test:
1. Run:
$ kshell
k$ prove t/db_dependent/Koha/Biblio/Metadata.t
=> FAIL: There's a warn, no tests for it :-(
2. Apply this patch
3. Repeat 1
=> SUCCESS: A new test was added, no more warns printed
4. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
use Test::More tests => 3;
use Test::Exception;
+use Test::Warn;
use t::lib::TestBuilder;
use t::lib::Mocks;
subtest 'record() tests' => sub {
- plan tests => 8;
+ plan tests => 9;
$schema->storage->txn_begin;
}
);
- throws_ok { $bad_data->record; }
- 'Koha::Exceptions::Metadata::Invalid', 'Exception thrown on bad record';
+ warning_like
+ { throws_ok { $bad_data->record; }
+ 'Koha::Exceptions::Metadata::Invalid', 'Exception thrown on bad record'; }
+ qr/parser error : Start tag expected, '<' not found/,
+ 'Warning thrown excplicitly';
my $exception = $@;
is( $exception->id, $bad_data->id, 'id passed correctly to exception' );