Bug 13746: Add tests
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 25 Feb 2015 12:21:07 +0000 (13:21 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sun, 15 Mar 2015 11:40:12 +0000 (08:40 -0300)
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/db_dependent/Serials.t

index c255b9e..d04dd02 100644 (file)
@@ -15,7 +15,7 @@ use C4::Bookseller;
 use C4::Biblio;
 use C4::Budgets;
 use Koha::DateUtils;
-use Test::More tests => 43;
+use Test::More tests => 47;
 
 BEGIN {
     use_ok('C4::Serials');
@@ -65,17 +65,26 @@ my $pattern_id = AddSubscriptionNumberpattern({
     whenmorethan1 => 1,
 });
 
+my $notes = 'notes';
+my $internalnotes = 'intnotes';
 my $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,
+    1,          $notes,undef, '2013-01-01', undef, $pattern_id,
+    undef,       undef,  0,    $internalnotes,  0,
     undef, undef, 0,          undef,         '2013-12-31', 0
 );
 
 my $subscriptioninformation = GetSubscription( $subscriptionid );
 
+is( $subscriptioninformation->{notes}, $notes, 'NewSubscription should set notes' );
+is( $subscriptioninformation->{internalnotes}, $internalnotes, 'NewSubscription should set internalnotes' );
+
+my $subscription_history = C4::Serials::GetSubscriptionHistoryFromSubscriptionId($subscriptionid);
+is( $subscription_history->{opacnote}, '', 'NewSubscription should not set subscriptionhistory opacnotes' );
+is( $subscription_history->{librariannote}, '', 'NewSubscription should not set subscriptionhistory librariannotes' );
+
 my @subscriptions = GetSubscriptions( $$subscriptioninformation{bibliotitle} );
 isa_ok( \@subscriptions, 'ARRAY' );
 
@@ -189,8 +198,8 @@ $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,
+    1,          $notes,undef, '2013-01-01', undef, $pattern_id,
+    undef,       undef,  0,    $internalnotes,  0,
     undef, undef, 0,          undef,         '2013-12-31', 0
 );
 my $total_issues;