Bugzilla – Attachment 131055 Details for
Bug 22321
Make it possible to edit illrequests.borrowernumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22321: Add unit tests
Bug-22321-Add-unit-tests.patch (text/plain), 3.00 KB, created by
Magnus Enger
on 2022-02-24 08:57:55 UTC
(
hide
)
Description:
Bug 22321: Add unit tests
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2022-02-24 08:57:55 UTC
Size:
3.00 KB
patch
obsolete
>From 544a45d5f2d743d03277d5250b7bd3d67d142a9e Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Mon, 14 Feb 2022 11:14:36 +0000 >Subject: [PATCH] Bug 22321: Add unit tests > >To test: >1. prove t/db_dependent/Illrequests.t >2. Observe test failure > > 1..3 > ok 1 - before change, original borrowernumber found > not ok 2 - after change, changed borrowernumber found in holds > # Failed test 'after change, changed borrowernumber found in holds' > # at t/db_dependent/Illrequests.t line 167. > # got: '3786' > # expected: '3787' > ok 3 - after change, changed borrowernumber found in illrequests > # Looks like you failed 1 test of 3. >not ok 4 - store borrowernumber change also updates holds > >Signed-off-by: Magnus Enger <magnus@libriotech.no> >--- > t/db_dependent/Illrequests.t | 51 +++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 50 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Illrequests.t >index 2fa89337f0..a8260b5633 100755 >--- a/t/db_dependent/Illrequests.t >+++ b/t/db_dependent/Illrequests.t >@@ -41,7 +41,7 @@ use Test::Exception; > use Test::Deep qw/ cmp_deeply ignore /; > use Test::Warn; > >-use Test::More tests => 13; >+use Test::More tests => 14; > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >@@ -125,6 +125,55 @@ subtest 'Basic object tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'store borrowernumber change also updates holds' => sub { >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ Koha::Illrequests->search->delete; >+ >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $other_patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $biblio = $builder->build_object({ class => 'Koha::Biblios' }); >+ >+ my $request = $builder->build_object({ >+ class => 'Koha::Illrequests', >+ value => { >+ borrowernumber => $patron->borrowernumber, >+ biblio_id => $biblio->biblionumber, >+ } >+ }); >+ $builder->build({ >+ source => 'Reserve', >+ value => { >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $request->biblio_id >+ } >+ }); >+ >+ my $hold = Koha::Holds->find({ >+ biblionumber => $request->biblio_id, >+ borrowernumber => $request->borrowernumber, >+ }); >+ >+ is( $hold->borrowernumber, $request->borrowernumber, >+ 'before change, original borrowernumber found' ); >+ >+ $request->borrowernumber( $other_patron->borrowernumber )->store; >+ >+ # reload changes >+ $hold->discard_changes; >+ >+ is( $hold->borrowernumber, $other_patron->borrowernumber, >+ 'after change, changed borrowernumber found in holds' ); >+ >+ is( $request->borrowernumber, $other_patron->borrowernumber, >+ 'after change, changed borrowernumber found in illrequests' ); >+ >+ $schema->storage->txn_rollback; >+ >+}; >+ > subtest 'Working with related objects' => sub { > > plan tests => 7; >-- >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 22321
:
130544
|
130545
|
130546
|
131012
|
131013
|
131055
|
131056
|
131057
|
131058
|
131059
|
138873
|
138874
|
138875
|
138876
|
138877
|
138878
|
141342
|
141343
|
141344
|
141345
|
141346
|
141347