Bugzilla – Attachment 65846 Details for
Bug 13012
suggestion.suggesteddate should be set to NOW if not defined
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13012: Add more tests
Bug-13012-Add-more-tests.patch (text/plain), 2.04 KB, created by
Jonathan Druart
on 2017-08-10 18:55:46 UTC
(
hide
)
Description:
Bug 13012: Add more tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-08-10 18:55:46 UTC
Size:
2.04 KB
patch
obsolete
>From f4ce66b0e2bc1ea601124b74994fa54427683d84 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 10 Aug 2017 15:52:35 -0300 >Subject: [PATCH] Bug 13012: Add more tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Koha/Suggestions.t | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Suggestions.t b/t/db_dependent/Koha/Suggestions.t >index 0a2af42345..732ac68582 100644 >--- a/t/db_dependent/Koha/Suggestions.t >+++ b/t/db_dependent/Koha/Suggestions.t >@@ -47,7 +47,25 @@ my $new_suggestion_2 = Koha::Suggestion->new( > } > )->store; > >-is( $new_suggestion_1->suggesteddate, dt_from_string()->ymd, "If suggesteddate not passed in, it will default to today" ); >+subtest 'store' => sub { >+ plan tests => 3; >+ my $suggestion = Koha::Suggestion->new( >+ { suggestedby => $patron->{borrowernumber}, >+ biblionumber => $biblio_1->{biblionumber}, >+ } >+ )->store; >+ >+ is( $suggestion->suggesteddate, dt_from_string()->ymd, "If suggesteddate not passed in, it will default to today" ); >+ my $two_days_ago = dt_from_string->subtract( days => 2 ); >+ my $two_days_ago_sql = output_pref({dt => $two_days_ago, dateformat => 'sql', dateonly => 1 }); >+ $suggestion->suggesteddate($two_days_ago)->store; >+ $suggestion = Koha::Suggestions->find( $suggestion->suggestionid ); >+ is( $suggestion->suggesteddate, $two_days_ago_sql, 'If suggesteddate passed in, it should be taken into account' ); >+ $suggestion->reason('because!')->store; >+ $suggestion = Koha::Suggestions->find( $suggestion->suggestionid ); >+ is( $suggestion->suggesteddate, $two_days_ago_sql, 'If suggestion id modified, suggesteddate should not be modified' ); >+ $suggestion->delete; >+}; > > like( $new_suggestion_1->suggestionid, qr|^\d+$|, 'Adding a new suggestion should have set the suggestionid' ); > is( Koha::Suggestions->search->count, $nb_of_suggestions + 2, 'The 2 suggestions should have been added' ); >-- >2.11.0
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 13012
:
65127
|
65139
|
65845
| 65846