|
Lines 1-7
Link Here
|
| 1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
| 2 |
|
2 |
|
| 3 |
#use Test::NoWarnings; |
3 |
#use Test::NoWarnings; |
| 4 |
use Test::More tests => 4; |
4 |
use Test::More tests => 5; |
| 5 |
use Test::Warn; |
5 |
use Test::Warn; |
| 6 |
|
6 |
|
| 7 |
use Koha::Items; |
7 |
use Koha::Items; |
|
Lines 369-371
subtest 'errors_in_marc' => sub {
Link Here
|
| 369 |
|
369 |
|
| 370 |
$schema->storage->txn_rollback(); |
370 |
$schema->storage->txn_rollback(); |
| 371 |
}; |
371 |
}; |
| 372 |
- |
372 |
|
|
|
373 |
subtest 'nonexistent_AV' => sub { |
| 374 |
|
| 375 |
plan tests => 2; |
| 376 |
|
| 377 |
$schema->storage->txn_begin(); |
| 378 |
|
| 379 |
my $biblio_ok = $builder->build_sample_biblio; |
| 380 |
my $item_ok = $builder->build_sample_item( { biblionumber => $biblio_ok->biblionumber } ); |
| 381 |
my $biblio_ko = $builder->build_sample_biblio; |
| 382 |
my $item_ko = $builder->build_sample_item( { biblionumber => $biblio_ko->biblionumber } ); |
| 383 |
|
| 384 |
my $biblios = Koha::Biblios->search( { biblionumber => [ $biblio_ok->biblionumber, $biblio_ko->biblionumber ] } ); |
| 385 |
|
| 386 |
subtest 'ok' => sub { |
| 387 |
plan tests => 1; |
| 388 |
my @errors = Koha::Database::DataInconsistency->nonexistent_AV($biblios); |
| 389 |
is_deeply( \@errors, [] ); |
| 390 |
}; |
| 391 |
|
| 392 |
subtest 'ccode not an AV' => sub { |
| 393 |
plan tests => 1; |
| 394 |
$item_ko->set( { withdrawn => -1 } )->store; |
| 395 |
my @errors = Koha::Database::DataInconsistency->nonexistent_AV($biblios); |
| 396 |
is( scalar(@errors), 1 ); |
| 397 |
}; |
| 398 |
}; |