View | Details | Raw Unified | Return to bug 40777
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Database/DataInconsistency.t (-3 / +42 lines)
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 => 5;
4
use Test::More tests => 7;
5
use Test::Warn;
5
use Test::Warn;
6
6
7
use Koha::Items;
7
use Koha::Items;
Lines 396-398 subtest 'nonexistent_AV' => sub { Link Here
396
        is( scalar(@errors), 1 );
396
        is( scalar(@errors), 1 );
397
    };
397
    };
398
};
398
};
399
- 
399
400
subtest 'empty_title' => sub {
401
402
    plan tests => 3;
403
404
    $schema->storage->txn_begin();
405
406
    my $biblio_ok = $builder->build_sample_biblio;
407
    my $item_ok   = $builder->build_sample_item( { biblionumber => $biblio_ok->biblionumber } );
408
    my $biblio_ko = $builder->build_sample_biblio;
409
    my $item_ko   = $builder->build_sample_item( { biblionumber => $biblio_ko->biblionumber } );
410
411
    my $biblios = Koha::Biblios->search( { biblionumber => [ $biblio_ok->biblionumber, $biblio_ko->biblionumber ] } );
412
413
    subtest 'ok' => sub {
414
        plan tests => 1;
415
        my @errors = Koha::Database::DataInconsistency->empty_title($biblios);
416
        is_deeply( \@errors, [] );
417
    };
418
419
    subtest 'title => undef' => sub {
420
        plan tests => 1;
421
        $biblio_ko->set( { title => undef } )->store;
422
        my @errors = Koha::Database::DataInconsistency->empty_title($biblios);
423
        is_deeply(
424
            \@errors,
425
            [ sprintf 'Biblio with biblionumber=%s does not have title defined', $biblio_ko->biblionumber ]
426
        );
427
    };
428
429
    subtest 'title => ""' => sub {
430
        plan tests => 1;
431
        $biblio_ko->set( { title => q{} } )->store;
432
        my @errors = Koha::Database::DataInconsistency->empty_title($biblios);
433
        is_deeply(
434
            \@errors,
435
            [ sprintf 'Biblio with biblionumber=%s does not have title defined', $biblio_ko->biblionumber ]
436
        );
437
    };
438
};

Return to bug 40777