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

(-)a/t/db_dependent/Items.t (-3 / +24 lines)
Lines 20-26 use Data::Dumper; Link Here
20
20
21
use MARC::Record;
21
use MARC::Record;
22
use C4::Items
22
use C4::Items
23
    qw( ModItemTransfer SearchItems AddItemFromMarc ModItemFromMarc get_hostitemnumbers_of Item2Marc ModDateLastSeen CartToShelf );
23
    qw( ModItemTransfer SearchItems AddItemFromMarc ModItemFromMarc get_hostitemnumbers_of Item2Marc ModDateLastSeen CartToShelf CheckItemPreSave );
24
use C4::Biblio qw( GetMarcFromKohaField AddBiblio );
24
use C4::Biblio qw( GetMarcFromKohaField AddBiblio );
25
use C4::Circulation qw( AddIssue );
25
use C4::Circulation qw( AddIssue );
26
use Koha::BackgroundJobs;
26
use Koha::BackgroundJobs;
Lines 36-42 use Koha::AuthorisedValues; Link Here
36
use t::lib::Mocks;
36
use t::lib::Mocks;
37
use t::lib::TestBuilder;
37
use t::lib::TestBuilder;
38
38
39
use Test::More tests => 13;
39
use Test::More tests => 14;
40
40
41
use Test::Warn;
41
use Test::Warn;
42
42
Lines 129-134 subtest 'General Add, Get and Del tests' => sub { Link Here
129
    $schema->storage->txn_rollback;
129
    $schema->storage->txn_rollback;
130
};
130
};
131
131
132
subtest 'CheckItemPreSave tests' => sub {
133
    plan tests => 1;
134
135
    $schema->storage->txn_begin;
136
137
    my $builder = t::lib::TestBuilder->new;
138
    my $item    = Koha::Items->find( { barcode => 'SPAGHETTI' } );
139
    $item = $builder->build_sample_item( { barcode => "SPAGHETTI" } ) unless $item;
140
141
    my $check_item = $item->unblessed;
142
    delete $check_item->{itemnumber};
143
    $check_item->{barcode} = " SPAGHETTI";
144
145
    my %errors = CheckItemPreSave($check_item);
146
    is_deeply(
147
        \%errors, { duplicate_barcode => " SPAGHETTI" },
148
        "We get a duplicate item error for barcode even if whitespace"
149
    );
150
151
    $schema->storage->txn_rollback;
152
};
153
132
subtest 'ModItemTransfer tests' => sub {
154
subtest 'ModItemTransfer tests' => sub {
133
    plan tests => 8;
155
    plan tests => 8;
134
156
135
- 

Return to bug 37550