Bugzilla – Attachment 25695 Details for
Bug 11689
New missing statuses is not well managed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11689: Add unit tests for serials statuses
Bug-11689-Add-unit-tests-for-serials-statuses.patch (text/plain), 4.11 KB, created by
Jonathan Druart
on 2014-02-27 12:18:51 UTC
(
hide
)
Description:
Bug 11689: Add unit tests for serials statuses
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-02-27 12:18:51 UTC
Size:
4.11 KB
patch
obsolete
>From cf384cea2a3f4c167c41f9e53798183954a7aea9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 27 Feb 2014 13:12:16 +0100 >Subject: [PATCH] Bug 11689: Add unit tests for serials statuses > >prove t/db_dependent/Serials.t > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > t/db_dependent/Serials.t | 57 +++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 56 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index e942982..a363999c 100644 >--- a/t/db_dependent/Serials.t >+++ b/t/db_dependent/Serials.t >@@ -14,7 +14,8 @@ use C4::Debug; > use C4::Bookseller; > use C4::Biblio; > use C4::Budgets; >-use Test::More tests => 35; >+use Koha::DateUtils; >+use Test::More tests => 44; > > BEGIN { > use_ok('C4::Serials'); >@@ -180,4 +181,58 @@ is(C4::Serials::check_routing(), undef, 'test checking route'); > > is(C4::Serials::addroutingmember(),undef, 'test adding route member'); > >+ >+# Unit tests for statuses management (Bug 11689) >+$subscriptionid = NewSubscription( >+ undef, "", undef, undef, $budget_id, $biblionumber, >+ '2013-01-01', $frequency_id, undef, undef, undef, >+ undef, undef, undef, undef, undef, undef, >+ 1, "notes",undef, '2013-01-01', undef, $pattern_id, >+ undef, undef, 0, "intnotes", 0, >+ undef, undef, 0, undef, '2013-12-31', 0 >+); >+my $total_issues; >+( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid ); >+is( $total_issues, 1, "NewSubscription created a first serial" ); >+is( @serials, 1, "GetSerials returns the serial" ); >+my $subscription = C4::Serials::GetSubscription($subscriptionid); >+my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); >+( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid ); >+my $publisheddate = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); >+( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid ); >+my $nextpublisheddate = C4::Serials::GetNextDate($subscription, $publisheddate, 1); >+my @statuses = qw( 2 2 3 3 3 3 3 4 4 41 42 43 44 5 ); >+# Add 14 serials >+my $counter = 0; >+for my $status ( @statuses ) { >+ my $serialseq = "No.".$counter; >+ my ( $expected_serial ) = GetSerials2( $subscriptionid, 1 ); >+ C4::Serials::ModSerialStatus( $expected_serial->{serialid}, $serialseq, $publisheddate, $publisheddate, $statuses[$counter], 'an useless note' ); >+ $counter++; >+} >+# Here we have 15 serials with statuses : 2*2 + 5*3 + 2*4 + 1*41 + 1*42 + 1*43 + 1*44 + 1*5 + 1*1 >+( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid ); >+is( $total_issues, @statuses + 1, "GetSerials returns total_issues" ); >+my @arrived_missing = map { my $status = $_->{status}; ( grep { /^$status$/ } qw( 2 4 41 42 43 44 5 ) ) ? $_ : () } @serials; >+my @others = map { my $status = $_->{status}; ( grep { /^$status$/ } qw( 2 4 41 42 43 44 5 ) ) ? () : $_ } @serials; >+is( @arrived_missing, 5, "GetSerials returns 5 arrived/missing by default" ); >+is( @others, 6, "GetSerials returns all serials not arrived and not missing" ); >+ >+( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid, 10 ); >+is( $total_issues, @statuses + 1, "GetSerials returns total_issues" ); >+@arrived_missing = map { my $status = $_->{status}; ( grep { /^$status$/ } qw( 2 4 41 42 43 44 5 ) ) ? $_ : () } @serials; >+@others = map { my $status = $_->{status}; ( grep { /^$status$/ } qw( 2 4 41 42 43 44 5 ) ) ? () : $_ } @serials; >+is( @arrived_missing, 9, "GetSerials returns all arrived/missing if count given" ); >+is( @others, 6, "GetSerials returns all serials not arrived and not missing if count given" ); >+ >+$subscription = C4::Serials::GetSubscription($subscriptionid); # Retrieve the updated subscription >+ >+my @serialseqs; >+for my $am ( reverse @arrived_missing ) { >+ if ( grep {/^$am->{status}$/} qw( 4 41 42 43 44 5 ) ) { >+ push @serialseqs, $am->{serialseq} >+ } >+} >+is( $subscription->{missinglist}, 'not issued ' . join('; ', @serialseqs), "subscription missinglist is updated after ModSerialStatus" ); >+ > $dbh->rollback; >-- >1.7.10.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 11689
:
25047
|
25308
|
25537
|
25538
|
25631
|
25695
|
25696
|
26389
|
26390
|
26391
|
26392