Bugzilla – Attachment 28638 Details for
Bug 11430
Search history: Delete selected lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11430: UT: add unit tests to delete only selected lines
Bug-11430-UT-add-unit-tests-to-delete-only-selecte.patch (text/plain), 1.95 KB, created by
Jonathan Druart
on 2014-06-03 08:49:47 UTC
(
hide
)
Description:
Bug 11430: UT: add unit tests to delete only selected lines
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-06-03 08:49:47 UTC
Size:
1.95 KB
patch
obsolete
>From 1195cc57c805f92e5dcdac657a208b172b8fd49e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 20 Dec 2013 16:32:47 +0100 >Subject: [PATCH] Bug 11430: UT: add unit tests to delete only selected lines > >--- > t/db_dependent/Search/History.t | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Search/History.t b/t/db_dependent/Search/History.t >index 33e834d..5cd0c77 100644 >--- a/t/db_dependent/Search/History.t >+++ b/t/db_dependent/Search/History.t >@@ -2,8 +2,9 @@ > > use Modern::Perl; > >-use Test::More tests => 16; >+use Test::More tests => 18; > use URI::Escape; >+use List::Util qw( shuffle ); > > use C4::Context; > my $dbh = C4::Context->dbh; >@@ -127,6 +128,27 @@ $all = C4::Search::History::get({userid => $userid}); > is( scalar(@$all), 9, 'There are still 9 searches after calling delete without userid' ); > delete_all( $userid ); > >+# Delete (with a given id) >+add( $userid, $current_sessionid, $previous_sessionid, $total, $query_cgi_b, $query_cgi_a ); >+$all = C4::Search::History::get({ userid => $userid }); >+# Delete 5 searches >+my $ids = [ shuffle map { $_->{id} } @$all ]; >+for my $id ( @$ids[ 0 .. 4 ] ) { >+ C4::Search::History::delete({ id => $id }); >+} >+$all = C4::Search::History::get({ userid => $userid }); >+is( scalar(@$all), 4, 'There are 4 searches after calling 5 times delete with id' ); >+delete_all( $userid ); >+ >+add( $userid, $current_sessionid, $previous_sessionid, $total, $query_cgi_b, $query_cgi_a ); >+$all = C4::Search::History::get({ userid => $userid }); >+# Delete 5 searches >+$ids = [ shuffle map { $_->{id} } @$all ]; >+C4::Search::History::delete({ id => [ @$ids[0..4] ] }); >+$all = C4::Search::History::get({ userid => $userid }); >+is( scalar(@$all), 4, 'There are 4 searches after calling delete with 5 ids' ); >+delete_all( $userid ); >+ > sub add { > my ( $userid, $current_session_id, $previous_sessionid, $total, $query_cgi_b, $query_cgi_a ) = @_; > >-- >2.0.0.rc2
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 11430
:
23713
|
23714
|
23715
|
23716
|
23717
|
23718
|
25499
|
25500
|
25501
|
25502
|
25503
|
25504
|
25618
|
28636
|
28637
|
28638
|
28639
|
28640
|
28641
|
28642
|
29042
|
29043
|
29044
|
29045
|
29046
|
29047
|
29048
|
29059
|
29081
|
29082
|
29083
|
29084
|
29085
|
29106
|
29107
|
29108
|
29109
|
29110
|
29592
|
29635
|
29636
|
29637
|
29638
|
29639
|
29640
|
33831
|
33832
|
33833
|
33834
|
33835
|
33836
|
36444
|
36820
|
36821
|
36822