Lines 16-29
Link Here
|
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use Test::More tests => 25; |
19 |
|
20 |
use t::lib::Mocks; |
20 |
use Test::More tests => 26; |
21 |
use C4::Circulation; |
21 |
|
22 |
use C4::Context; |
22 |
use C4::Context; |
23 |
|
23 |
|
24 |
BEGIN { |
24 |
use_ok( 'C4::Circulation' ); |
25 |
t::lib::Mocks::mock_dbh; |
|
|
26 |
}; |
27 |
|
25 |
|
28 |
C4::Context->_new_userenv(123456); |
26 |
C4::Context->_new_userenv(123456); |
29 |
C4::Context->set_userenv(1,'kmkale' , 1, 'km', 'kale' , 'IMS', 'IMS Branch DEscription', 0, 'kmkale@anantcorp.com'); |
27 |
C4::Context->set_userenv(1,'kmkale' , 1, 'km', 'kale' , 'IMS', 'IMS Branch DEscription', 0, 'kmkale@anantcorp.com'); |
Lines 49-73
our %outputs = (
Link Here
|
49 |
my @filters = sort keys %inputs; |
47 |
my @filters = sort keys %inputs; |
50 |
foreach my $filter (@filters) { |
48 |
foreach my $filter (@filters) { |
51 |
foreach my $datum (@{$inputs{$filter}}) { |
49 |
foreach my $datum (@{$inputs{$filter}}) { |
52 |
my $expect = shift @{$outputs{$filter}} or die "Internal Test Error: missing expected output for filter '$filter' on input '$datum'"; |
50 |
my $expect = shift @{$outputs{$filter}} |
|
|
51 |
or die "Internal Test Error: missing expected output for filter '$filter' on input '$datum'"; |
53 |
my $output = C4::Circulation::barcodedecode($datum, $filter); |
52 |
my $output = C4::Circulation::barcodedecode($datum, $filter); |
54 |
ok($output eq $expect, sprintf("%12s: %20s => %15s", $filter, "'$datum'", "'$expect'")); |
53 |
ok($output eq $expect, sprintf("%12s: %20s => %15s", $filter, "'$datum'", "'$expect'")); |
55 |
($output eq $expect) or diag "Bad output: '$output'"; |
54 |
($output eq $expect) or diag "Bad output: '$output'"; |
56 |
} |
55 |
} |
57 |
} |
56 |
} |
58 |
|
57 |
|
59 |
__END__ |
58 |
# T-prefix style is derived from zero-padded "Follett Classic Code 3 of 9". From: |
60 |
|
59 |
# www.fsc.follett.com/_file/File/pdf/Barcode%20Symbology%20Q%20%20A%203_05.pdf |
61 |
=head2 C4::Circulation::barcodedecode() |
60 |
# ~ 1 to 7 characters |
62 |
|
61 |
# ~ T, P or X followed by numeric characters |
63 |
This tests avoids being dependent on the database by using the optional |
62 |
# ~ No checkdigit |
64 |
second argument to barcodedecode. |
|
|
65 |
|
66 |
T-prefix style is derived from zero-padded "Follett Classic Code 3 of 9". From: |
67 |
www.fsc.follett.com/_file/File/pdf/Barcode%20Symbology%20Q%20%20A%203_05.pdf |
68 |
|
69 |
~ 1 to 7 characters |
70 |
~ T, P or X followed by numeric characters |
71 |
~ No checkdigit |
72 |
|
63 |
|
73 |
=cut |
64 |
1; |
74 |
- |
|
|