Bugzilla – Attachment 156888 Details for
Bug 22188
Use publication date as numbering pattern
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22188: Tests
Bug-22188-Tests.patch (text/plain), 4.21 KB, created by
Danyon Sewell
on 2023-10-12 02:34:47 UTC
(
hide
)
Description:
Bug 22188: Tests
Filename:
MIME Type:
Creator:
Danyon Sewell
Created:
2023-10-12 02:34:47 UTC
Size:
4.21 KB
patch
obsolete
>From eb28aab3bb9feba17a57eefce0d39dcad24f4b3c Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 14 Aug 2019 04:01:02 +0000 >Subject: [PATCH] Bug 22188: Tests > >This patch fixes the t/db_dependent/Serials.t test which fails with this >feature (without this fix). > >Ensure all other tests that use NewSubscription, ModSubscription, GetNextSeq, >GetSeq still pass. >db_dependent/Acquisition/OrderFromSubscription.t >db_dependent/Bookseller.t >db_dependent/Koha/Acquisition/Booksellers.t >db_dependent/Letters.t >db_dependent/Serials.t >db_dependent/Serials/Claims.t >db_dependent/Serials/ReNewSubscription.t >db_dependent/Serials_2.t >db_dependent/Serials/Frequency.t >db_dependent/Serials/Numberpattern.t >db_dependent/Serials/GetNextSeq.t >Serials/GetNextSeq.t > >This patch also adds tests to db_dependent/Serials_2.t so check these >tests pass > >prove -v t/db_dependent/Serials_2.t > >Sponsored-by: Brimbank Libraries Australia >--- > C4/Serials.pm | 2 +- > t/db_dependent/Serials.t | 3 ++- > t/db_dependent/Serials_2.t | 37 ++++++++++++++++++++++++++++++++++++- > 3 files changed, 39 insertions(+), 3 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index b4de5a8baa..2945c233c4 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -936,7 +936,7 @@ the sequence in string format > sub GetSeq { > my ($subscription, $pattern) = @_; > >- if ($pattern->{numberingmethod} eq ''){ >+ if ( !defined($pattern->{numberingmethod}) ){ > return "pubdate"; > } > >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index eb432dc914..8bc4535699 100755 >--- a/t/db_dependent/Serials.t >+++ b/t/db_dependent/Serials.t >@@ -229,7 +229,8 @@ is(C4::Serials::GetLatestSerials(), undef, 'test getting lastest serials'); > > is(C4::Serials::GetNextSeq(), undef, 'test getting next seq when you enter nothing'); > >-is(C4::Serials::GetSeq(), undef, 'test getting seq when you enter nothing'); >+is(C4::Serials::GetSeq(), 'pubdate', 'test getting seq when you enter nothing'); >+# no input means assume using publication date as numbering pattern > > is(C4::Serials::CountSubscriptionFromBiblionumber(), undef, 'test counting subscription when nothing is entered'); > >diff --git a/t/db_dependent/Serials_2.t b/t/db_dependent/Serials_2.t >index d0a1b7a615..a2d72ceeeb 100755 >--- a/t/db_dependent/Serials_2.t >+++ b/t/db_dependent/Serials_2.t >@@ -1,13 +1,14 @@ > #!/usr/bin/perl > use Modern::Perl; > >-use Test::More tests => 50; >+use Test::More tests => 52; > > use MARC::Record; > > use C4::Biblio qw( AddBiblio ); > use Koha::Database; > use Koha::Patrons; >+use Koha::DateUtils qw( dt_from_string ); > use t::lib::Mocks; > use t::lib::TestBuilder; > use_ok('C4::Serials', qw( NewSubscription GetSubscription NewIssue GetPreviousSerialid )); >@@ -291,3 +292,37 @@ sub set_flags { > ); > } > } >+ >+# test publication date as numbering pattern >+ >+my $subscriptionid_pubdatenumpattern = NewSubscription( >+ undef, $my_branch, undef, undef, $budget_id, $biblionumber, >+ '2013-01-01', undef, undef, undef, undef, >+ undef, undef, undef, undef, undef, >+ undef, 1, "notes", undef, '2013-01-01', undef, >+ undef, undef, undef, 0, "intnotes", >+ 0, undef, undef, 0, >+ undef, '2013-12-31', 0, undef, undef, undef, >+ 'dmy' >+); >+ >+my $serial_pubdatenumpattern = Koha::Serials->find({ subscriptionid => $subscriptionid_pubdatenumpattern }); >+ >+is( $serial_pubdatenumpattern->serialseq, '01 January 2013', 'serialseq should be set to first acuisition date in the date format specified' ); >+ >+ModSubscription( >+ undef, $my_branch, undef, undef, $budget_id, '2013-01-01', >+ undef, '2013-01-01', undef, undef, undef, >+ undef, undef, undef, undef, undef, >+ undef, undef, undef, undef, 1, >+ $biblionumber, undef, "notes", undef, 0, >+ "intnotes", 0, undef, undef, >+ 0, undef, '2013-12-31', $subscriptionid_pubdatenumpattern, 0, >+ undef, undef, undef, 'ydm' >+); >+ >+my $serialid_pubdatenumpattern = NewIssue( "pubdate", $subscriptionid_pubdatenumpattern, $biblionumber, 1 ); >+ >+my $serial_pubdatenumpattern_2 = Koha::Serials->find( $serialid_pubdatenumpattern ); >+ >+is( $serial_pubdatenumpattern_2->serialseq, dt_from_string( $serial_pubdatenumpattern_2->publisheddate )->strftime('%Y %d %B'), 'receive new issue with new pub date num pattern format' ); >-- >2.30.2
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 22188
:
84314
|
85415
|
85540
|
85541
|
85542
|
86419
|
87433
|
88830
|
91761
|
91762
|
92185
|
92186
|
92345
|
92364
|
94290
|
94291
|
156886
|
156887
|
156888
|
156889
|
156890
|
156891
|
157009
|
157010
|
157011
|
157012
|
157013
|
157014
|
157015
|
157179
|
158638
|
158659