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

(-)a/t/db_dependent/Koha/Biblio.t (-4 / +3 lines)
Lines 646-663 subtest 'item_groups() tests' => sub { Link Here
646
646
647
    my $biblio = $builder->build_sample_biblio();
647
    my $biblio = $builder->build_sample_biblio();
648
648
649
    my @item_groups = $biblio->item_groups;
649
    my @item_groups = $biblio->item_groups->as_list;
650
    is( scalar(@item_groups), 0, 'Got zero item groups');
650
    is( scalar(@item_groups), 0, 'Got zero item groups');
651
651
652
    my $item_group_1 = Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store();
652
    my $item_group_1 = Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store();
653
653
654
    @item_groups = $biblio->item_groups;
654
    @item_groups = $biblio->item_groups->as_list;
655
    is( scalar(@item_groups), 1, 'Got one item group');
655
    is( scalar(@item_groups), 1, 'Got one item group');
656
    is( $item_groups[0]->id, $item_group_1->id, 'Got correct item group');
656
    is( $item_groups[0]->id, $item_group_1->id, 'Got correct item group');
657
657
658
    my $item_group_2 = Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store();
658
    my $item_group_2 = Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store();
659
659
660
    @item_groups = $biblio->item_groups;
660
    @item_groups = $biblio->item_groups->as_list;
661
    is( scalar(@item_groups), 2, 'Got two item groups');
661
    is( scalar(@item_groups), 2, 'Got two item groups');
662
    is( $item_groups[0]->id, $item_group_1->id, 'Got correct item group 1');
662
    is( $item_groups[0]->id, $item_group_1->id, 'Got correct item group 1');
663
    is( $item_groups[1]->id, $item_group_2->id, 'Got correct item group 2');
663
    is( $item_groups[1]->id, $item_group_2->id, 'Got correct item group 2');
664
- 

Return to bug 24857