Bugzilla – Attachment 48365 Details for
Bug 15877
C4::Barcodes does not correctly calculate db_max for 'annual' barcodes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15877 - Unit tests
Bug-15877---Unit-tests.patch (text/plain), 2.01 KB, created by
Nick Clemens (kidclamp)
on 2016-02-24 17:57:41 UTC
(
hide
)
Description:
Bug 15877 - Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2016-02-24 17:57:41 UTC
Size:
2.01 KB
patch
obsolete
>From abd6cb624bac66910fc724aec9b83909dfac3e9d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 24 Feb 2016 17:56:23 +0000 >Subject: [PATCH] Bug 15877 - Unit tests > >--- > t/db_dependent/Barcodes.t | 51 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 50 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Barcodes.t b/t/db_dependent/Barcodes.t >index d987bd5..0ca4af0 100755 >--- a/t/db_dependent/Barcodes.t >+++ b/t/db_dependent/Barcodes.t >@@ -17,8 +17,12 @@ > > use Modern::Perl; > >-use Test::More tests => 73; >+use Test::More tests => 75; > use Test::Warn; >+use Test::MockModule; >+use t::lib::TestBuilder; >+ >+use Koha::Database; > > $| = 1; > >@@ -28,6 +32,49 @@ BEGIN { > use_ok('C4::Barcodes'); > } > >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new; >+ >+my $dbh = C4::Context->dbh; >+ >+#Test generation of annual barcodes from >+$dbh->do(q|DELETE FROM issues|); >+$dbh->do(q|DELETE FROM items|); >+ >+my $barcodeobj = C4::Barcodes->new('annual'); >+ >+my $barcodevalue = $barcodeobj->value(); >+ >+my $item_1 = $builder->build({ >+ source => 'Item', >+ value => { >+ barcode => $barcodevalue >+ } >+}); >+ >+ok($barcodevalue eq $barcodeobj->db_max(), "(annual) First barcode saved to db is equal to db_max" ); >+ >+$barcodevalue = $barcodeobj->next_value(); >+$barcodevalue = $barcodeobj->next_value(); >+$barcodevalue = $barcodeobj->next_value(); >+$barcodevalue = $barcodeobj->next_value(); >+$barcodevalue = $barcodeobj->next_value(); >+ >+my $item_2 = $builder->build({ >+ source => 'Item', >+ value => { >+ barcode => $barcodevalue >+ } >+}); >+ >+$barcodeobj = C4::Barcodes->new('annual'); >+ok($barcodevalue eq $barcodeobj->db_max(), '(annual) db_max should equal the greatest barcode in the db when more than 1 present'); >+ >+$dbh->do(q|DELETE FROM issues|); >+$dbh->do(q|DELETE FROM items|); >+ > my %thash = ( > incremental => [], > annual => [], >@@ -112,3 +159,5 @@ foreach $format (@formats) { > } > } > } >+ >+ >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15877
:
48363
|
48365
|
48367
|
49197
|
49198
|
49600
|
49926
|
49927
|
49928
|
49961
|
49962