Bugzilla – Attachment 67932 Details for
Bug 17015
New Koha Calendar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17015 - Updated Koha tests to use the new DiscreteCalendar module
Bug-17015---Updated-Koha-tests-to-use-the-new-Disc.patch (text/plain), 5.99 KB, created by
Alex Buckley
on 2017-10-11 09:38:10 UTC
(
hide
)
Description:
Bug 17015 - Updated Koha tests to use the new DiscreteCalendar module
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-10-11 09:38:10 UTC
Size:
5.99 KB
patch
obsolete
>From a424ed350087734a41f33582ed5b1245ac80a79d Mon Sep 17 00:00:00 2001 >From: Mehdi Hamidi <mehdi.hamidi@inlibro.com> >Date: Mon, 16 Jan 2017 10:13:20 -0500 >Subject: [PATCH] Bug 17015 - Updated Koha tests to use the new > DiscreteCalendar module > >All tests in t directory (including test files modified by this patch) >pass and all modified files in this patch pass QA test >tool > >Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> >--- > t/db_dependent/Circulation/CalcFine.t | 26 ++++---------------------- > t/db_dependent/Fines.t | 11 ++++++----- > t/db_dependent/HoldsQueue.t | 27 ++++++++++++++++++--------- > 3 files changed, 28 insertions(+), 36 deletions(-) > >diff --git a/t/db_dependent/Circulation/CalcFine.t b/t/db_dependent/Circulation/CalcFine.t >index 862673f..bdfe0bb 100644 >--- a/t/db_dependent/Circulation/CalcFine.t >+++ b/t/db_dependent/Circulation/CalcFine.t >@@ -90,17 +90,8 @@ subtest 'Test basic functionality' => sub { > } > ); > >- my $start_dt = DateTime->new( >- year => 2000, >- month => 1, >- day => 1, >- ); >- >- my $end_dt = DateTime->new( >- year => 2000, >- month => 1, >- day => 30, >- ); >+ my $start_dt = DateTime->today; >+ my $end_dt = DateTime->today->add(days => 29); > > my ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt ); > >@@ -129,17 +120,8 @@ subtest 'Test cap_fine_to_replacement_price' => sub { > } > ); > >- my $start_dt = DateTime->new( >- year => 2000, >- month => 1, >- day => 1, >- ); >- >- my $end_dt = DateTime->new( >- year => 2000, >- month => 1, >- day => 30, >- ); >+ my $start_dt = DateTime->today; >+ my $end_dt = DateTime->today->add(days => 29); > > my ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt ); > >diff --git a/t/db_dependent/Fines.t b/t/db_dependent/Fines.t >index 1f273ba..8e9d018 100644 >--- a/t/db_dependent/Fines.t >+++ b/t/db_dependent/Fines.t >@@ -1,6 +1,7 @@ > #!/usr/bin/perl > > use Modern::Perl; >+use DateTime; > > use C4::Context; > use C4::Overdues; >@@ -34,23 +35,23 @@ my $issuingrule = $schema->resultset('Issuingrule')->create( > > ok( $issuingrule, 'Issuing rule created' ); > >-my $period_start = dt_from_string('2000-01-01'); >-my $period_end = dt_from_string('2000-01-05'); >+my $period_start = DateTime->today; >+my $period_end = DateTime->today->add(days => 4); > > my ( $fine ) = CalcFine( {}, q{}, q{}, $period_start, $period_end ); > is( $fine, 0, '4 days overdue, charge period 7 days, charge at end of interval gives fine of $0' ); > >-$period_end = dt_from_string('2000-01-10'); >+$period_end = DateTime->today->add(days => 9); > ( $fine ) = CalcFine( {}, q{}, q{}, $period_start, $period_end ); > is( $fine, 1, '9 days overdue, charge period 7 days, charge at end of interval gives fine of $1' ); > > # Test charging fine at the *beginning* of each charge period > $issuingrule->update( { chargeperiod_charge_at => 1 } ); > >-$period_end = dt_from_string('2000-01-05'); >+$period_end = DateTime->today->add(days => 4); > ( $fine ) = CalcFine( {}, q{}, q{}, $period_start, $period_end ); > is( $fine, 1, '4 days overdue, charge period 7 days, charge at start of interval gives fine of $1' ); > >-$period_end = dt_from_string('2000-01-10'); >+$period_end = DateTime->today->add(days => 9); > ( $fine ) = CalcFine( {}, q{}, q{}, $period_start, $period_end ); > is( $fine, 2, '9 days overdue, charge period 7 days, charge at start of interval gives fine of $2' ); >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index e2f749a..9ba0322 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -11,9 +11,9 @@ use Modern::Perl; > use Test::More tests => 44; > use Data::Dumper; > >-use C4::Calendar; > use C4::Context; > use C4::Members; >+use Koha::DiscreteCalendar; > use Koha::Database; > use Koha::DateUtils; > use Koha::Items; >@@ -189,6 +189,21 @@ $library2 = $builder->build({ > $library3 = $builder->build({ > source => 'Branch', > }); >+ >+$schema->resultset('DiscreteCalendar')->search({ >+ branchcode =>'DFLT' >+})->update_all({ >+ isopened => 1, >+ holidaytype => '', >+ note => '', >+ openhour => '08:00:00', >+ closehour => '16:00:00' >+}); >+ >+Koha::DiscreteCalendar->new( branchcode => 'DFLT' )->add_new_branch('DFLT', $library1->{branchcode}); >+Koha::DiscreteCalendar->new( branchcode => 'DFLT' )->add_new_branch('DFLT', $library2->{branchcode}); >+Koha::DiscreteCalendar->new( branchcode => 'DFLT' )->add_new_branch('DFLT', $library3->{branchcode}); >+ > @branchcodes = ( $library1->{branchcode}, $library2->{branchcode}, $library3->{branchcode} ); > > my $borrower1 = $builder->build({ >@@ -302,16 +317,10 @@ is( $holds_queue->[1]->{cardnumber}, $borrower2->{cardnumber}, "Holds queue fill > # have 1 row in the holds queue > t::lib::Mocks::mock_preference('HoldsQueueSkipClosed', 1); > my $today = dt_from_string(); >-C4::Calendar->new( branchcode => $branchcodes[0] )->insert_single_holiday( >- day => $today->day(), >- month => $today->month(), >- year => $today->year(), >- title => "$today", >- description => "$today", >-); > # If the test below is removed, aother tests using the holiday will fail. For some reason if we call is_holiday now > # the holiday will get set in cache correctly, but not if we let C4::HoldsQueue call is_holiday instead. >-is( Koha::Calendar->new( branchcode => $branchcodes[0] )->is_holiday( $today ), 1, 'Is today a holiday for pickup branch' ); >+Koha::DiscreteCalendar->new( branchcode => $branchcodes[0] )->edit_holiday("Today", '', "E", '', '', $today, $today); >+is( Koha::DiscreteCalendar->new( branchcode => $branchcodes[0] )->is_holiday( $today ), 1, 'Is today a holiday for pickup branch' ); > C4::HoldsQueue::CreateQueue(); > $holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} }); > is( scalar( @$holds_queue ), 1, "Holds not filled with items from closed libraries" ); >-- >2.1.4
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 17015
:
53859
|
54318
|
54419
|
59166
|
59167
|
59168
|
59169
|
59170
|
59171
|
59267
|
59268
|
59269
|
59270
|
59271
|
59463
|
59516
|
59517
|
59518
|
59519
|
59520
|
59561
|
59562
|
59586
|
59587
|
59888
|
59889
|
60902
|
60903
|
60904
|
60905
|
60906
|
60986
|
61737
|
62375
|
62376
|
62380
|
63257
|
63282
|
63362
|
63363
|
63364
|
63365
|
63366
|
63367
|
64235
|
65073
|
65074
|
65075
|
65076
|
65077
|
67721
|
67722
|
67723
|
67724
|
67725
|
67879
|
67929
|
67930
|
67931
|
67932
|
67933
|
67934
|
68392
|
68393
|
68394
|
68395
|
68396
|
68397
|
71634
|
71635
|
71636
|
71637
|
71638
|
72890
|
73145
|
74859
|
74860
|
74861
|
74862
|
74863
|
74864
|
74865
|
74866
|
75444
|
75479
|
76594
|
77249
|
77250
|
77607
|
77608
|
77609
|
77610
|
77611
|
77612
|
77613
|
77770
|
77771
|
77772
|
77773
|
77774
|
79035
|
80523
|
80524
|
80525
|
80526
|
80527
|
80528
|
80529
|
80530
|
80531
|
80532
|
80533
|
80534
|
80535
|
83547
|
85394
|
85677
|
85678
|
85679
|
85680
|
85681
|
85682
|
85683
|
85684
|
85685
|
85686
|
85687
|
85688
|
85689
|
85690
|
85691
|
92595
|
92596
|
92597
|
92598
|
100079
|
110383
|
110384
|
110386
|
110387
|
110388
|
110389
|
113541
|
113905
|
115501
|
115502
|
115503
|
115504
|
115505
|
115506
|
115507
|
115508
|
115509
|
115510
|
115511
|
118554
|
118555
|
118556
|
118557
|
118558
|
118559
|
119095
|
119097
|
119099
|
119100
|
119101
|
119102
|
131619
|
131620
|
131621
|
131622
|
131623
|
131624
|
131625
|
131626
|
131634
|
131635
|
131636
|
131637
|
131638
|
131639
|
131640
|
131641
|
131667
|
132199
|
133596
|
133597
|
133598
|
133599
|
133600
|
133601
|
133602
|
133603
|
133604
|
133605
|
133678
|
137219
|
137220
|
137221
|
137222
|
137223
|
137224
|
137225
|
137226
|
137227
|
137228
|
137229
|
139378
|
139379
|
139380
|
139381
|
139382
|
139599
|
139600
|
139601
|
139602
|
139603
|
139851
|
140150
|
141176
|
144257
|
144258
|
144259
|
144260
|
144261
|
144262
|
144264
|
144268
|
144269
|
144270
|
144271
|
144272
|
144273
|
151438
|
151439
|
151440
|
151441
|
151442
|
151443
|
151444
|
151445
|
151446
|
151447
|
151448
|
151449
|
151450
|
156340
|
156341
|
156342
|
156343
|
156344
|
156345
|
156346
|
156347
|
156348
|
156349
|
156350
|
156351
|
156352
|
156353
|
156354
|
156355
|
157656
|
157657
|
157658
|
157659
|
157660
|
157661
|
157662
|
157663
|
157664
|
157665
|
157666
|
157667
|
157668
|
157669
|
157670
|
157671
|
157672
|
167805
|
167806
|
167807
|
167808
|
167809