Bugzilla – Attachment 116076 Details for
Bug 27580
NULL values not correctly handled in Koha::Items->filter_by_visible_in_opac
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27580: Regression tests
Bug-27580-Regression-tests.patch (text/plain), 4.82 KB, created by
Tomás Cohen Arazi
on 2021-01-29 19:46:54 UTC
(
hide
)
Description:
Bug 27580: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2021-01-29 19:46:54 UTC
Size:
4.82 KB
patch
obsolete
>From ce263d32ba96b6f1a5b74a58bc12b0cf284154c5 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 29 Jan 2021 16:40:27 -0300 >Subject: [PATCH] Bug 27580: Regression tests > >This test makes all the generated sample items have undef copynumber, >and all rules are added copynumber => [ 2 ] on the tests as >suggested by Andrew on his failing example. > >The tests are expected to pass. i.e. copynumber is clearly not equal to >2, so those items shouldn't be hidden. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Items.t >=> FAIL: Tests fail! undef is considered in [ 2 ] > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Items.t | 28 +++++++++++++++++----------- > 1 file changed, 17 insertions(+), 11 deletions(-) > >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index a9631ba0177..980cd12bfea 100755 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -1345,7 +1345,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > biblionumber => $biblio->biblionumber, > itemlost => -1, > itype => $itype_1->itemtype, >- withdrawn => 1 >+ withdrawn => 1, >+ copynumber => undef > } > ); > my $item_2 = $builder->build_sample_item( >@@ -1353,7 +1354,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > biblionumber => $biblio->biblionumber, > itemlost => 0, > itype => $itype_2->itemtype, >- withdrawn => 2 >+ withdrawn => 2, >+ copynumber => undef > } > ); > my $item_3 = $builder->build_sample_item( >@@ -1361,7 +1363,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > biblionumber => $biblio->biblionumber, > itemlost => 1, > itype => $itype_1->itemtype, >- withdrawn => 3 >+ withdrawn => 3, >+ copynumber => undef > } > ); > my $item_4 = $builder->build_sample_item( >@@ -1369,7 +1372,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > biblionumber => $biblio->biblionumber, > itemlost => 0, > itype => $itype_2->itemtype, >- withdrawn => 4 >+ withdrawn => 4, >+ copynumber => undef > } > ); > my $item_5 = $builder->build_sample_item( >@@ -1377,7 +1381,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > biblionumber => $biblio->biblionumber, > itemlost => 0, > itype => $itype_1->itemtype, >- withdrawn => 5 >+ withdrawn => 5, >+ copynumber => undef > } > ); > my $item_6 = $builder->build_sample_item( >@@ -1385,7 +1390,8 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > biblionumber => $biblio->biblionumber, > itemlost => 2, > itype => $itype_1->itemtype, >- withdrawn => 5 >+ withdrawn => 5, >+ copynumber => undef > } > ); > >@@ -1403,7 +1409,7 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > is( $biblio->items->filter_by_visible_in_opac({ patron => $patron })->count, > 6, 'No rules passed, hidelostitems unset, patron exception changes nothing' ); > >- $rules = {}; >+ $rules = { copynumber => [ 2 ] }; > > t::lib::Mocks::mock_preference( 'hidelostitems', 1 ); > is( >@@ -1418,7 +1424,7 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > 'No rules passed, hidelostitems set, patron exception changes nothing' > ); > >- $rules = { withdrawn => [ 1, 2 ] }; >+ $rules = { withdrawn => [ 1, 2 ], copynumber => [ 2 ] }; > is( > $biblio->items->filter_by_visible_in_opac->count, > 2, >@@ -1431,14 +1437,14 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > 'hidelostitems set, rules on withdrawn but patron override passed' > ); > >- $rules = { itype => [ $itype_1->itemtype ] }; >+ $rules = { itype => [ $itype_1->itemtype ], copynumber => [ 2 ] }; > is( > $biblio->items->filter_by_visible_in_opac->count, > 2, > 'Rules on itype, hidelostitems set' > ); > >- $rules = { withdrawn => [ 1, 2 ], itype => [ $itype_1->itemtype ] }; >+ $rules = { withdrawn => [ 1, 2 ], itype => [ $itype_1->itemtype ], copynumber => [ 2 ] }; > is( > $biblio->items->filter_by_visible_in_opac->count, > 1, >@@ -1451,7 +1457,7 @@ subtest 'filter_by_visible_in_opac() tests' => sub { > 'The right item is returned' > ); > >- $rules = { withdrawn => [ 1, 2 ], itype => [ $itype_2->itemtype ] }; >+ $rules = { withdrawn => [ 1, 2 ], itype => [ $itype_2->itemtype ], copynumber => [ 2 ] }; > is( > $biblio->items->filter_by_visible_in_opac->count, > 1, >-- >2.30.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 27580
:
116076
|
116077
|
116080
|
116081
|
116094
|
116095