Lines 33-39
use Koha::Caches;
Link Here
|
33 |
use t::lib::Mocks; |
33 |
use t::lib::Mocks; |
34 |
use t::lib::TestBuilder; |
34 |
use t::lib::TestBuilder; |
35 |
|
35 |
|
36 |
use Test::More tests => 15; |
36 |
use Test::More tests => 16; |
37 |
|
37 |
|
38 |
use Test::Warn; |
38 |
use Test::Warn; |
39 |
|
39 |
|
Lines 953-955
subtest 'Split subfields in Item2Marc (Bug 21774)' => sub {
Link Here
|
953 |
|
953 |
|
954 |
$schema->storage->txn_rollback; |
954 |
$schema->storage->txn_rollback; |
955 |
}; |
955 |
}; |
956 |
- |
956 |
|
|
|
957 |
subtest 'tests for GetMarcItem' => sub { |
958 |
plan tests => 1; |
959 |
$schema->storage->txn_begin; |
960 |
|
961 |
my $builder = t::lib::TestBuilder->new; |
962 |
my $library = $builder->build({ source => 'Branch', }); |
963 |
my $itemtype = $builder->build({ source => 'Itemtype', }); |
964 |
my $biblio = $builder->build({ |
965 |
source => 'Biblio', |
966 |
value=>{ |
967 |
frameworkcode => "", |
968 |
} |
969 |
}); |
970 |
my $biblioitem = $builder->build({ |
971 |
source => 'Biblioitem', |
972 |
value => { biblionumber => $biblio->{biblionumber} }, |
973 |
}); |
974 |
my $item1 = $builder->build_object({ |
975 |
class => 'Koha::Items', |
976 |
value => { |
977 |
biblionumber => $biblio->{biblionumber}, |
978 |
biblioitemnumber => $biblioitem->{biblioitemnumber}, |
979 |
itype => $itemtype->{itype}, |
980 |
homebranch => $library->{branchcode}, |
981 |
barcode => undef, |
982 |
restricted => 1, |
983 |
itemcallnumber => "", |
984 |
cn_sort => "", |
985 |
} |
986 |
}); |
987 |
my ($itemtag, $item_num_subfield )=C4::Biblio::GetMarcFromKohaField("items.itemnumber"); |
988 |
my $get_itemnumber = $item1->itemnumber; |
989 |
my $item1_marc = C4::Items::GetMarcItem( $biblio->{biblionumber}, $item1->itemnumber ); |
990 |
my (undef, undef, $itemnumber2 ) = AddItemFromMarc( $item1_marc, $biblio->{biblionumber} ); |
991 |
my $item2_marc = C4::Items::GetMarcItem( $biblio->{biblionumber}, $itemnumber2 ); |
992 |
($itemtag, $item_num_subfield )=C4::Biblio::GetMarcFromKohaField("items.itemnumber"); #get itemnumber tag |
993 |
$item1_marc->field($itemtag)->delete_subfield(code => $item_num_subfield); #and remove it |
994 |
$item2_marc->field($itemtag)->delete_subfield(code => $item_num_subfield); #because it won't match |
995 |
is_deeply( $item1_marc, $item2_marc, "The Marc should match if the items are the same"); |
996 |
$schema->storage->txn_rollback; |
997 |
}; |