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

(-)a/t/db_dependent/Items.t (-3 / +10 lines)
Lines 34-43 BEGIN { Link Here
34
my $dbh = C4::Context->dbh;
34
my $dbh = C4::Context->dbh;
35
my $branches = GetBranches;
35
my $branches = GetBranches;
36
my ($branch1, $branch2) = keys %$branches;
36
my ($branch1, $branch2) = keys %$branches;
37
my $location = 'My Location';
37
38
38
subtest 'General Add, Get and Del tests' => sub {
39
subtest 'General Add, Get and Del tests' => sub {
39
40
40
    plan tests => 6;
41
    plan tests => 10;
41
42
42
    # Start transaction
43
    # Start transaction
43
    $dbh->{AutoCommit} = 0;
44
    $dbh->{AutoCommit} = 0;
Lines 48-54 subtest 'General Add, Get and Del tests' => sub { Link Here
48
    my ($bibnum, $bibitemnum) = get_biblio();
49
    my ($bibnum, $bibitemnum) = get_biblio();
49
50
50
    # Add an item.
51
    # Add an item.
51
    my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch1, holdingbranch => $branch1 } , $bibnum);
52
    my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch1, holdingbranch => $branch1, location => $location } , $bibnum);
52
    cmp_ok($item_bibnum, '==', $bibnum, "New item is linked to correct biblionumber.");
53
    cmp_ok($item_bibnum, '==', $bibnum, "New item is linked to correct biblionumber.");
53
    cmp_ok($item_bibitemnum, '==', $bibitemnum, "New item is linked to correct biblioitemnumber.");
54
    cmp_ok($item_bibitemnum, '==', $bibitemnum, "New item is linked to correct biblioitemnumber.");
54
55
Lines 56-61 subtest 'General Add, Get and Del tests' => sub { Link Here
56
    my $getitem = GetItem($itemnumber);
57
    my $getitem = GetItem($itemnumber);
57
    cmp_ok($getitem->{'itemnumber'}, '==', $itemnumber, "Retrieved item has correct itemnumber.");
58
    cmp_ok($getitem->{'itemnumber'}, '==', $itemnumber, "Retrieved item has correct itemnumber.");
58
    cmp_ok($getitem->{'biblioitemnumber'}, '==', $item_bibitemnum, "Retrieved item has correct biblioitemnumber.");
59
    cmp_ok($getitem->{'biblioitemnumber'}, '==', $item_bibitemnum, "Retrieved item has correct biblioitemnumber.");
60
    is( $getitem->{location}, $location, "The location should not have been modified" );
61
    is( $getitem->{permanent_location}, $location, "The permanent_location should have been set to the location value" );
59
62
60
    # Modify item; setting barcode.
63
    # Modify item; setting barcode.
61
    ModItem({ barcode => '987654321' }, $bibnum, $itemnumber);
64
    ModItem({ barcode => '987654321' }, $bibnum, $itemnumber);
Lines 67-72 subtest 'General Add, Get and Del tests' => sub { Link Here
67
    my $getdeleted = GetItem($itemnumber);
70
    my $getdeleted = GetItem($itemnumber);
68
    is($getdeleted->{'itemnumber'}, undef, "Item deleted as expected.");
71
    is($getdeleted->{'itemnumber'}, undef, "Item deleted as expected.");
69
72
73
    ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch1, holdingbranch => $branch1, location => $location, permanent_location => 'my permanent location' } , $bibnum);
74
    $getitem = GetItem($itemnumber);
75
    is( $getitem->{location}, $location, "The location should not have been modified" );
76
    is( $getitem->{permanent_location}, 'my permanent location', "The permanent_location should not have modified" );
77
70
    $dbh->rollback;
78
    $dbh->rollback;
71
};
79
};
72
80
73
- 

Return to bug 7634