Bugzilla – Attachment 107239 Details for
Bug 23092
Add 'daterequested' to the transfers table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23092: Add unit tests
Bug-23092-Add-unit-tests.patch (text/plain), 2.42 KB, created by
Martin Renvoize (ashimema)
on 2020-07-23 13:41:17 UTC
(
hide
)
Description:
Bug 23092: Add unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-23 13:41:17 UTC
Size:
2.42 KB
patch
obsolete
>From d2d980b5d3c4d24d9ec61021afcd4f144f8ccf1e Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 16 Jun 2020 13:51:00 +0100 >Subject: [PATCH] Bug 23092: Add unit tests > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Item/Transfers.t | 43 +++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Item/Transfers.t b/t/db_dependent/Koha/Item/Transfers.t >index b49f78091a..28e070671f 100644 >--- a/t/db_dependent/Koha/Item/Transfers.t >+++ b/t/db_dependent/Koha/Item/Transfers.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > > use Koha::Item::Transfer; > use Koha::Item::Transfers; >@@ -27,6 +27,7 @@ use Koha::Database; > use Koha::DateUtils; > > use t::lib::TestBuilder; >+use t::lib::Dates; > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >@@ -66,3 +67,43 @@ is( $retrieved_transfer_1->itemnumber, $new_transfer_1->itemnumber, 'Find a tran > > $schema->storage->txn_rollback; > >+subtest 'daterequested tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ my $library_from = $builder->build( { source => 'Branch' } ); >+ my $library_to = $builder->build( { source => 'Branch' } ); >+ my $item = $builder->build( >+ { >+ source => 'Item', >+ value => { >+ holding_branch => $library_from->{branchcode}, >+ homebranch => $library_to->{branchcode} >+ } >+ } >+ ); >+ >+ my $now = dt_from_string; >+ my $transfer = Koha::Item::Transfer->new( >+ { >+ itemnumber => $item->{itemnumber}, >+ frombranch => $library_from->{branchcode}, >+ tobranch => $library_to->{branchcode} >+ } >+ )->store; >+ $transfer->discard_changes; >+ >+ ok( $transfer->daterequested, 'daterequested set on creation' ); >+ is( t::lib::Dates::compare( $transfer->daterequested, $now ), >+ 0, 'daterequested was set correctly' ); >+ >+ my $new_date = $now->clone->add( hours => 1 ); >+ $transfer->set({ datesent => $new_date })->store; >+ $transfer->discard_changes; >+ >+ is( t::lib::Dates::compare( $transfer->daterequested, $now ), >+ 0, 'daterequested is not updated when other fields are updated' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >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 23092
:
97512
|
97542
|
100631
|
101093
|
105912
|
105913
|
105916
|
105917
|
106609
|
106610
|
107238
| 107239