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

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

Return to bug 7634