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

(-)a/t/db_dependent/Items.t (-2 / +45 lines)
Lines 29-39 use Koha::Library; Link Here
29
use Koha::DateUtils;
29
use Koha::DateUtils;
30
use Koha::MarcSubfieldStructures;
30
use Koha::MarcSubfieldStructures;
31
use Koha::Caches;
31
use Koha::Caches;
32
use C4::Items;
32
33
33
use t::lib::Mocks;
34
use t::lib::Mocks;
34
use t::lib::TestBuilder;
35
use t::lib::TestBuilder;
35
36
36
use Test::More tests => 12;
37
use Test::More tests => 13;
37
use Test::Warn;
38
use Test::Warn;
38
39
39
my $schema = Koha::Database->new->schema;
40
my $schema = Koha::Database->new->schema;
Lines 857-862 subtest 'Test logging for ModItem' => sub { Link Here
857
    $schema->storage->txn_rollback;
858
    $schema->storage->txn_rollback;
858
};
859
};
859
860
861
subtest 'tests for GetMarcItem' => sub {
862
863
    plan tests => 1;
864
    $schema->storage->txn_begin;
865
    my $builder  = t::lib::TestBuilder->new;
866
    my $library  = $builder->build({ source => 'Branch', });
867
    my $itemtype = $builder->build({ source => 'Itemtype', });
868
    my $biblio   = $builder->build({
869
        source => 'Biblio',
870
        value=>{
871
            frameworkcode => "",
872
        }
873
    });
874
    my $biblioitem = $builder->build({
875
        source => 'Biblioitem',
876
        value => { biblionumber => $biblio->{biblionumber} },
877
    });
878
    my $item1 = $builder->build_object({
879
        class => 'Koha::Items',
880
        value => {
881
            biblionumber     => $biblio->{biblionumber},
882
            biblioitemnumber => $biblioitem->{biblioitemnumber},
883
            itype            => $itemtype->{itype},
884
            homebranch       => $library->{branchcode},
885
            barcode          => undef,
886
            restricted       => 1,
887
            itemcallnumber   => "",
888
            cn_sort          => "",
889
        }
890
    });
891
    my ($itemtag, $item_num_subfield )=C4::Biblio::GetMarcFromKohaField("items.itemnumber");
892
    my $get_itemnumber = $item1->itemnumber;
893
    my $item1_marc = C4::Items::GetMarcItem( $biblio->{biblionumber}, $item1->itemnumber );
894
    my (undef, undef, $itemnumber2 ) = AddItemFromMarc( $item1_marc, $biblio->{biblionumber} );
895
    my $item2_marc = C4::Items::GetMarcItem( $biblio->{biblionumber}, $itemnumber2 );
896
    ($itemtag, $item_num_subfield )=C4::Biblio::GetMarcFromKohaField("items.itemnumber"); #get itemnumber tag
897
    $item1_marc->field($itemtag)->delete_subfield(code => $item_num_subfield); #and remove it
898
    $item2_marc->field($itemtag)->delete_subfield(code => $item_num_subfield); #because it won't match
899
    is_deeply( $item1_marc, $item2_marc, "The Marc should match if the items are the same");
900
    $schema->storage->txn_rollback;
901
902
};
903
860
# Helper method to set up a Biblio.
904
# Helper method to set up a Biblio.
861
sub get_biblio {
905
sub get_biblio {
862
    my ( $frameworkcode ) = @_;
906
    my ( $frameworkcode ) = @_;
863
- 

Return to bug 20664