|
Lines 21-26
use Modern::Perl;
Link Here
|
| 21 |
use Test::More tests => 2; |
21 |
use Test::More tests => 2; |
| 22 |
|
22 |
|
| 23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
|
|
24 |
use t::lib::Mocks; |
| 24 |
|
25 |
|
| 25 |
use C4::Context; |
26 |
use C4::Context; |
| 26 |
use C4::Biblio; |
27 |
use C4::Biblio; |
|
Lines 43-49
subtest 'Verify results with OldWay' => sub {
Link Here
|
| 43 |
}; |
44 |
}; |
| 44 |
|
45 |
|
| 45 |
subtest 'Use cn_sort rather than callnumber to determine correct location' => sub { |
46 |
subtest 'Use cn_sort rather than callnumber to determine correct location' => sub { |
| 46 |
plan tests => 1; |
47 |
plan tests => 3; |
| 47 |
|
48 |
|
| 48 |
my $builder = t::lib::TestBuilder->new; |
49 |
my $builder = t::lib::TestBuilder->new; |
| 49 |
|
50 |
|
|
Lines 58-64
subtest 'Use cn_sort rather than callnumber to determine correct location' => su
Link Here
|
| 58 |
} |
59 |
} |
| 59 |
}); |
60 |
}); |
| 60 |
|
61 |
|
| 61 |
#Find if we have any items in our test range before we start |
62 |
t::lib::Mocks::mock_preference('UseCNSortForInventory', '0'); |
|
|
63 |
#Find if we have any items in our test range before we start (using callnumber) |
| 64 |
my( undef, $pre_nosort_item_count) = GetItemsForInventory({ |
| 65 |
maxlocation => 'GT100', |
| 66 |
minlocation => 'GT90', |
| 67 |
class_source => $class_source->{cn_source}, |
| 68 |
}); |
| 69 |
|
| 70 |
t::lib::Mocks::mock_preference('UseCNSortForInventory', '1'); |
| 71 |
#Find if we have any items in our test range before we start (using cn_sort) |
| 62 |
my( undef, $pre_item_count) = GetItemsForInventory({ |
72 |
my( undef, $pre_item_count) = GetItemsForInventory({ |
| 63 |
maxlocation => 'GT100', |
73 |
maxlocation => 'GT100', |
| 64 |
minlocation => 'GT90', |
74 |
minlocation => 'GT90', |
|
Lines 72-84
subtest 'Use cn_sort rather than callnumber to determine correct location' => su
Link Here
|
| 72 |
cn_sort => GetClassSort($class_source->{cn_source},undef,'GT95'), |
82 |
cn_sort => GetClassSort($class_source->{cn_source},undef,'GT95'), |
| 73 |
} |
83 |
} |
| 74 |
}); |
84 |
}); |
|
|
85 |
my $item_1 = $builder->build({ |
| 86 |
source => 'Item', |
| 87 |
value => { |
| 88 |
itemcallnumber => 'GT101', |
| 89 |
cn_sort => GetClassSort($class_source->{cn_source},undef,'GT101'), |
| 90 |
} |
| 91 |
}); |
| 75 |
|
92 |
|
| 76 |
my( undef, $item_count) = GetItemsForInventory({ |
93 |
my( undef, $item_count) = GetItemsForInventory({ |
| 77 |
maxlocation => 'GT100', |
94 |
maxlocation => 'GT100', |
| 78 |
minlocation => 'GT90', |
95 |
minlocation => 'GT90', |
| 79 |
class_source => $class_source->{cn_source}, |
96 |
class_source => $class_source->{cn_source}, |
| 80 |
}); |
97 |
}); |
| 81 |
is($item_count,$pre_item_count + 1,"We should return GT95 as between GT90 and GT100"); |
98 |
is($item_count,$pre_item_count + 1,"We should return GT95 as between GT90 and GT100, but not GT101"); |
|
|
99 |
|
| 100 |
t::lib::Mocks::mock_preference('UseCNSortForInventory', '0'); |
| 101 |
my( undef, $item_nosort_count) = GetItemsForInventory({ |
| 102 |
maxlocation => 'GT100', |
| 103 |
minlocation => 'GT90', |
| 104 |
class_source => $class_source->{cn_source}, |
| 105 |
}); |
| 106 |
is($item_nosort_count,$pre_nosort_item_count,"We won't return GT95 or 101 as between GT90 and GT100 if using callnumber"); |
| 107 |
my( undef, $item_nosort_count_1) = GetItemsForInventory({ |
| 108 |
maxlocation => 'GT90', |
| 109 |
minlocation => 'GT100', |
| 110 |
class_source => $class_source->{cn_source}, |
| 111 |
}); |
| 112 |
is($item_nosort_count_1,$pre_nosort_item_count + 1,"We won't include GT95 but will include GT101 as between GT100 and GT90 if using callnumber"); |
| 82 |
|
113 |
|
| 83 |
}; |
114 |
}; |
| 84 |
|
115 |
|