Bugzilla – Attachment 161869 Details for
Bug 35248
Bookings needs unit tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35248: Add Koha::Biblio->bookings unit test
Bug-35248-Add-KohaBiblio-bookings-unit-test.patch (text/plain), 1.80 KB, created by
David Nind
on 2024-02-07 22:52:56 UTC
(
hide
)
Description:
Bug 35248: Add Koha::Biblio->bookings unit test
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-02-07 22:52:56 UTC
Size:
1.80 KB
patch
obsolete
>From 7cbacc253c694bfe9f57ac8198dc59e672407aeb Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 30 Jan 2024 14:00:17 +0000 >Subject: [PATCH] Bug 35248: Add Koha::Biblio->bookings unit test > >This patch adds unit tests for the bookings relationship accessor on >Koha::Biblio objects. > >Test plan >1) Run t/db_dependant/Koha/Biblio.t > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/Koha/Biblio.t | 36 +++++++++++++++++++++++++++++++++++- > 1 file changed, 35 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 13be09f466..5624ac28c1 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 30; >+use Test::More tests => 31; > use Test::Exception; > use Test::Warn; > >@@ -486,6 +486,40 @@ subtest 'to_api() tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'bookings() tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $biblio = $builder->build_sample_biblio(); >+ >+ is( ref( $biblio->bookings ), 'Koha::Bookings', 'Return type is correct' ); >+ >+ is_deeply( >+ $biblio->bookings->unblessed, >+ [], >+ '->bookings returns an empty Koha::Bookings resultset' >+ ); >+ >+ my $booking = $builder->build_object( >+ { >+ class => 'Koha::Bookings', >+ value => { biblio_id => $biblio->biblionumber } >+ } >+ ); >+ >+ my $bookings = $biblio->bookings->unblessed; >+ >+ is_deeply( >+ $biblio->bookings->unblessed, >+ [ $booking->unblessed ], >+ '->bookings returns the related Koha::Booking objects' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'suggestions() tests' => sub { > > plan tests => 3; >-- >2.30.2
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 35248
:
161061
|
161062
|
161608
|
161611
|
161620
|
161621
|
161632
|
161636
|
161651
|
161652
|
161653
|
161654
|
161655
|
161656
|
161657
|
161658
|
161659
|
161660
|
161821
|
161822
|
161823
|
161824
|
161825
|
161826
|
161827
|
161828
|
161829
|
161830
|
161831
|
161861
|
161862
|
161863
|
161864
|
161865
|
161866
|
161867
|
161868
|
161869
|
161870
|
161871
|
161890
|
161891
|
161893
|
161894
|
161895
|
161896
|
161897
|
161898
|
161899
|
161900
|
161901
|
161902
|
161903
|
161904
|
161905
|
161906
|
161907
|
161908
|
161909
|
161910
|
161911
|
161912