Bugzilla – Attachment 75814 Details for
Bug 20866
ArticleRequests.t fails on existing requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20866: (QA follow-up) Use build_object and remove two tests
Bug-20866-QA-follow-up-Use-buildobject-and-remove-.patch (text/plain), 3.00 KB, created by
Marcel de Rooy
on 2018-06-05 11:49:55 UTC
(
hide
)
Description:
Bug 20866: (QA follow-up) Use build_object and remove two tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-06-05 11:49:55 UTC
Size:
3.00 KB
patch
obsolete
>From e4019925d65f19b5868972c62783b1dec8a4054e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 5 Jun 2018 13:45:06 +0200 >Subject: [PATCH] Bug 20866: (QA follow-up) Use build_object and remove two > tests >Content-Type: text/plain; charset=utf-8 > >The unique constraint on userid is handled in TestBuilder. So let's use it. >The two tests if count==$count do not make much sense anymore when we >call ->count a few lines before. The check with search_limited is enough. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/ArticleRequests.t | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/ArticleRequests.t b/t/db_dependent/ArticleRequests.t >index cc43185..ab2145f 100755 >--- a/t/db_dependent/ArticleRequests.t >+++ b/t/db_dependent/ArticleRequests.t >@@ -67,17 +67,16 @@ ok( $item->id, 'Koha::Item created' ); > > my $branch = $builder->build({ source => 'Branch' }); > my $category = $builder->build({ source => 'Category' }); >-my $patron = Koha::Patron->new( >- { >+my $patron = $builder->build_object({ >+ class => 'Koha::Patrons', >+ value => { > categorycode => $category->{categorycode}, > branchcode => $branch->{branchcode}, > flags => 1,# superlibrarian >- userid => 'a_userid_for_tests', # So far Koha::Patron->store does not deal with userid, see bug 20287 >- } >-)->store(); >+ }, >+}); > ok( $patron->id, 'Koha::Patron created' ); >-my $patron_2 = $builder->build({ source => 'Borrower', value => { flags => 0 } }); >-$patron_2 = Koha::Patrons->find( $patron_2->{borrowernumber} ); >+my $patron_2 = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 0 } }); > > # store > Koha::Notice::Messages->delete; >@@ -204,7 +203,7 @@ is( $item->article_request_type($patron), 'no', 'Item article request type is no > $rule->delete(); > > subtest 'search_limited' => sub { >- plan tests => 4; >+ plan tests => 2; > C4::Context->_new_userenv('xxx'); > my $nb_article_requests = Koha::ArticleRequests->count; > >@@ -213,10 +212,8 @@ subtest 'search_limited' => sub { > Koha::Library::Group->new({ parent_id => $group_1->id, branchcode => $patron->branchcode })->store(); > Koha::Library::Group->new({ parent_id => $group_2->id, branchcode => $patron_2->branchcode })->store(); > set_logged_in_user( $patron ); # Is superlibrarian >- is( Koha::ArticleRequests->count, $nb_article_requests, 'Koha::ArticleRequests should return all article requests' ); > is( Koha::ArticleRequests->search_limited->count, $nb_article_requests, 'Koha::ArticleRequests->search_limited should return all article requests for superlibrarian' ); > set_logged_in_user( $patron_2 ); # Is restricted >- is( Koha::ArticleRequests->count, $nb_article_requests, 'Koha::ArticleRequests should return all article requests' ); > is( Koha::ArticleRequests->search_limited->count, 0, 'Koha::ArticleRequests->search_limited should not return all article requests for restricted patron' ); > }; > >-- >2.1.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 20866
:
75750
|
75784
|
75791
|
75813
| 75814