Bugzilla – Attachment 163814 Details for
Bug 35581
ILL Koha classes are not consistent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35581: Cleanup Comments.t
Bug-35581-Cleanup-Commentst.patch (text/plain), 3.31 KB, created by
Tomás Cohen Arazi
on 2024-03-25 13:33:37 UTC
(
hide
)
Description:
Bug 35581: Cleanup Comments.t
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2024-03-25 13:33:37 UTC
Size:
3.31 KB
patch
obsolete
>From 096c9f27c7715190a0247cba65a70361e10d0191 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 25 Mar 2024 09:59:44 -0300 >Subject: [PATCH] Bug 35581: Cleanup Comments.t > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/ILL/Comments.t | 44 +++++++++++++----------------- > 1 file changed, 19 insertions(+), 25 deletions(-) > >diff --git a/t/db_dependent/Koha/ILL/Comments.t b/t/db_dependent/Koha/ILL/Comments.t >index 3e1016592d2..2c57ba8646b 100755 >--- a/t/db_dependent/Koha/ILL/Comments.t >+++ b/t/db_dependent/Koha/ILL/Comments.t >@@ -28,7 +28,7 @@ use t::lib::TestBuilder; > use Test::MockObject; > use Test::MockModule; > >-use Test::More tests => 9; >+use Test::More tests => 8; > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >@@ -37,52 +37,46 @@ use_ok('Koha::ILL::Comments'); > > $schema->storage->txn_begin; > >-Koha::ILL::Requests->search->delete; >- > # Create a patron >-my $patron = $builder->build( { source => 'Borrower' } ); >+my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+# Create a librarian >+my $librarian = $builder->build_object( { class => 'Koha::Patrons' } ); > > # Create an ILL request >-my $illrq = $builder->build( >+my $illrq = $builder->build_object( > { >- source => 'Illrequest', >- value => { borrowernumber => $patron->{borrowernumber} } >+ class => 'Koha::ILL::Requests', >+ value => { borrowernumber => $patron->{borrowernumber} } > } > ); >-my $illrq_obj = Koha::ILL::Requests->find( $illrq->{illrequest_id} ); >-isa_ok( $illrq_obj, 'Koha::ILL::Request' ); >- >-# Create a librarian >-my $librarian = $builder->build( { source => 'Borrower' } ); > > # Create a comment and tie it to the request and the librarian > my $comment_text = 'xyz'; >-my $illcomment = $builder->build( >+my $illcomment = $builder->build_object( > { >- source => 'Illcomment', >- value => { >- illrequest_id => $illrq_obj->illrequest_id, >- borrowernumber => $librarian->{borrowernumber}, >+ class => 'Koha::ILL::Comments', >+ value => { >+ illrequest_id => $illrq->id, >+ borrowernumber => $librarian->id, > comment => $comment_text, > } > } > ); > > # Get all the comments >-my $comments = $illrq_obj->illcomments; >-isa_ok( $comments, 'Koha::ILL::Comments', "Illcomments" ); >+my $comments = $illrq->illcomments; >+isa_ok( $comments, 'Koha::ILL::Comments' ); > my @comments_list = $comments->as_list(); > is( scalar @comments_list, 1, "We have 1 comment" ); > > # Get the first (and only) comment > my $comment = $comments->next(); >-isa_ok( $comment, 'Koha::ILL::Comment', "Illcomment" ); >+isa_ok( $comment, 'Koha::ILL::Comment' ); > > # Check the different data in the comment >-is( $comment->illrequest_id, $illrq_obj->illrequest_id, 'illrequest_id getter works' ); >-is( $comment->borrowernumber, $librarian->{borrowernumber}, 'borrowernumber getter works' ); >-is( $comment->comment, $comment_text, 'comment getter works' ); >- >-$illrq_obj->delete; >+is( $comment->illrequest_id, $illrq->id, 'illrequest_id getter works' ); >+is( $comment->borrowernumber, $librarian->id, 'borrowernumber getter works' ); >+is( $comment->comment, $comment_text, 'comment getter works' ); > > $schema->storage->txn_rollback; >-- >2.44.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 35581
:
159863
|
159864
|
159865
|
159866
|
159867
|
159868
|
159869
|
159870
|
159871
|
159872
|
159873
|
160422
|
160423
|
160424
|
160425
|
160426
|
160427
|
160428
|
160429
|
160430
|
160431
|
160432
|
160620
|
160622
|
162020
|
162021
|
162022
|
162023
|
162024
|
162025
|
162026
|
162027
|
162028
|
162029
|
162030
|
162031
|
162032
|
162817
|
162818
|
162819
|
162820
|
162821
|
162822
|
162823
|
162824
|
162825
|
162826
|
162827
|
162828
|
162829
|
162880
|
162881
|
162882
|
162883
|
162884
|
162885
|
162886
|
162887
|
162888
|
162889
|
162890
|
162891
|
162892
|
163803
|
163804
|
163805
|
163806
|
163807
|
163808
|
163809
|
163810
|
163811
|
163812
|
163813
|
163814
|
163815
|
163816
|
164069
|
164070
|
164071
|
164072
|
164073
|
164074
|
164075
|
164076
|
164077
|
164078
|
164079
|
164080
|
164081
|
164082
|
165448