Bugzilla – Attachment 106971 Details for
Bug 25998
Add 'library' relation to Koha::Account::Line
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25998: Add Unit Tests
Bug-25998-Add-Unit-Tests.patch (text/plain), 2.16 KB, created by
Martin Renvoize (ashimema)
on 2020-07-17 07:02:05 UTC
(
hide
)
Description:
Bug 25998: Add Unit Tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-17 07:02:05 UTC
Size:
2.16 KB
patch
obsolete
>From 57fc40a5ba4e5c58474849161b1f4e6e7902edea Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 17 Jul 2020 08:01:06 +0100 >Subject: [PATCH] Bug 25998: Add Unit Tests > >--- > t/db_dependent/Koha/Account/Line.t | 44 +++++++++++++++++++++++++++++- > 1 file changed, 43 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t >index 0b35a590c6..fc4901ca54 100644 >--- a/t/db_dependent/Koha/Account/Line.t >+++ b/t/db_dependent/Koha/Account/Line.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 12; >+use Test::More tests => 13; > use Test::Exception; > use Test::MockModule; > >@@ -105,6 +105,48 @@ subtest 'item() tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'library() tests' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron = $builder->build( { source => 'Borrower' } ); >+ >+ my $line = Koha::Account::Line->new( >+ { >+ borrowernumber => $patron->{borrowernumber}, >+ branchcode => $library->branchcode, >+ debit_type_code => "OVERDUE", >+ status => "RETURNED", >+ amount => 10, >+ interface => 'commandline', >+ } >+ )->store; >+ >+ my $account_line_library = $line->library; >+ is( ref($account_line_library), >+ 'Koha::Library', >+ 'Koha::Account::Line->library should return a Koha::Library' ); >+ is( >+ $line->branchcode, >+ $account_line_library->branchcode, >+ 'Koha::Account::Line->library should return the correct library' >+ ); >+ >+ # Test ON DELETE SET NULL >+ $library->delete; >+ my $found = Koha::Account::Lines->find( $line->accountlines_id ); >+ ok( $found, "Koha::Account::Line not deleted when the linked library is deleted" ); >+ >+ is( $found->library, undef, >+'Koha::Account::Line->library should return undef if linked library has been deleted' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'is_credit() and is_debit() tests' => sub { > > plan tests => 4; >-- >2.20.1
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 25998
:
106945
|
106971
|
106972
|
106973
|
107122
|
107123
|
107124