Bug 35248 - Bookings needs unit tests
Summary: Bookings needs unit tests
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL: https://github.com/PTFS-Europe/koha/t...
Keywords:
Depends on: 35788
Blocks: 35906 35937 36120 36936 35944
  Show dependency treegraph
 
Reported: 2023-11-03 14:00 UTC by Martin Renvoize
Modified: 2024-06-26 13:16 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.04


Attachments
Bug 35248: Add unit test for Koha::Item->bookings relation (2.66 KB, patch)
2024-01-16 12:48 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->find_booking (6.06 KB, patch)
2024-01-16 12:48 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Unit tests for CanBookBeIssued (5.72 KB, patch)
2024-01-29 16:33 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->check_booking (4.21 KB, patch)
2024-01-29 18:35 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Drop ->place_booking (3.45 KB, patch)
2024-01-30 07:36 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add test for Koha::Exceptions::Booking (1.27 KB, patch)
2024-01-30 07:46 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Remove Koha::Booking->intersects (1.48 KB, patch)
2024-01-30 11:24 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Booking relations (4.22 KB, patch)
2024-01-30 13:54 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit test for Koha::Item->bookings relation (2.68 KB, patch)
2024-01-30 17:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->find_booking (6.06 KB, patch)
2024-01-30 17:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Unit tests for CanBookBeIssued (6.03 KB, patch)
2024-01-30 17:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->check_booking (4.21 KB, patch)
2024-01-30 17:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Drop ->place_booking (4.11 KB, patch)
2024-01-30 17:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add test for Koha::Exceptions::Booking (1.36 KB, patch)
2024-01-30 17:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Remove Koha::Booking->intersects (1.48 KB, patch)
2024-01-30 17:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Booking relations (4.22 KB, patch)
2024-01-30 17:10 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add Koha::Biblio->bookings unit test (1.76 KB, patch)
2024-01-30 17:10 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Bibilio->check_booking (4.05 KB, patch)
2024-01-30 17:10 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit test for Koha::Item->bookings relation (2.68 KB, patch)
2024-02-07 16:40 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->find_booking (6.06 KB, patch)
2024-02-07 16:40 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Unit tests for CanBookBeIssued (6.03 KB, patch)
2024-02-07 16:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->check_booking (4.21 KB, patch)
2024-02-07 16:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Drop ->place_booking (4.11 KB, patch)
2024-02-07 16:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add test for Koha::Exceptions::Booking (1.36 KB, patch)
2024-02-07 16:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Remove Koha::Booking->intersects (1.48 KB, patch)
2024-02-07 16:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Booking relations (4.22 KB, patch)
2024-02-07 16:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add Koha::Biblio->bookings unit test (1.76 KB, patch)
2024-02-07 16:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Bibilio->check_booking (4.05 KB, patch)
2024-02-07 16:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Bibilio->bookable_items (1.87 KB, patch)
2024-02-07 16:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit test for Koha::Item->bookings relation (2.73 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->find_booking (6.11 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Unit tests for CanBookBeIssued (6.08 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->check_booking (4.26 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Drop ->place_booking (3.93 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Add test for Koha::Exceptions::Booking (1.40 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Remove Koha::Booking->intersects (1.52 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Booking relations (4.26 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Add Koha::Biblio->bookings unit test (1.80 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Bibilio->check_booking (4.09 KB, patch)
2024-02-07 22:52 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Bibilio->bookable_items (1.91 KB, patch)
2024-02-07 22:53 UTC, David Nind
Details | Diff | Splinter Review
Bug 35248: Add tests for Koha::Booking->store (8.93 KB, patch)
2024-02-08 11:54 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Refactor - Move assign_item_for_booking (4.97 KB, patch)
2024-02-08 11:54 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add tests for Koha::Booking->store (9.02 KB, patch)
2024-02-08 12:17 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Refactor - Move assign_item_for_booking (4.97 KB, patch)
2024-02-08 12:17 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add tests for Koha::Booking->_assign_item_for_booking (1.36 KB, patch)
2024-02-08 12:17 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add tests for Koha::Booking->_assign_item_for_booking (1.36 KB, patch)
2024-02-08 12:19 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Whitespace clean (10.75 KB, patch)
2024-02-08 12:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35248: Add unit test for Koha::Item->bookings relation (2.78 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->find_booking (6.17 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Unit tests for CanBookBeIssued (6.14 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Item->check_booking (4.31 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Drop ->place_booking (3.99 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Add test for Koha::Exceptions::Booking (1.46 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Remove Koha::Booking->intersects (1.58 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Booking relations (4.32 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Add Koha::Biblio->bookings unit test (1.86 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Bibilio->check_booking (4.15 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Add unit tests for Koha::Bibilio->bookable_items (1.97 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Add tests for Koha::Booking->store (9.07 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Refactor - Move assign_item_for_booking (5.02 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Add tests for Koha::Booking->_assign_item_for_booking (1.42 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35248: Whitespace clean (10.80 KB, patch)
2024-02-08 13:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2023-11-03 14:00:49 UTC
Bug 29002 adds a bookings foundation, but as the code progressed with feedback coming in the original unit tests didn't keep up.

Tomas has agreed to push it without the tests so we can continue to test more widely and can onboard more developers working on the code.. but I do need to revisit it all and write tests for all the new modules and functions.

This bug serves to store the tests as I write them.
Comment 1 Martin Renvoize 2024-01-16 12:48:19 UTC
Created attachment 161061 [details] [review]
Bug 35248: Add unit test for Koha::Item->bookings relation

This patch adds a simple unit test for the 'bookings' relation accessor
added to Koha::Item.

Test plan
1) Run t/db_dependant/Koha/Item.t
Comment 2 Martin Renvoize 2024-01-16 12:48:22 UTC
Created attachment 161062 [details] [review]
Bug 35248: Add unit tests for Koha::Item->find_booking

This patch adds basic unit tests for the Koha::Item->find_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t
Comment 3 Martin Renvoize 2024-01-29 16:33:09 UTC
Created attachment 161608 [details] [review]
Bug 35248: Unit tests for CanBookBeIssued

Whilst writing the test, I found a minor flaw in the logic and fixed
that in CanBookBeIssued at the same time.
Comment 4 Martin Renvoize 2024-01-29 18:35:24 UTC
Created attachment 161611 [details] [review]
Bug 35248: Add unit tests for Koha::Item->check_booking

This patch adds basic unit tests for the Koha::Item->check_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t
Comment 5 Martin Renvoize 2024-01-30 07:36:41 UTC
Created attachment 161620 [details] [review]
Bug 35248: Drop ->place_booking

These methods were introduced and used in an earlier iteration of the
code, they are no longer called from anywhere (the code in
Koha::Booking->store handles all cases instead) and thus I choose to
remove them rather than add unit tests for them.. They are simple
methods that could be re-introduced as required at a future date.
Comment 6 Martin Renvoize 2024-01-30 07:46:47 UTC
Created attachment 161621 [details] [review]
Bug 35248: Add test for Koha::Exceptions::Booking
Comment 7 Martin Renvoize 2024-01-30 11:24:08 UTC
Created attachment 161632 [details] [review]
Bug 35248: Remove Koha::Booking->intersects

Another method left behind from an earlier iteration.. not actually
called anywhere in the final submission in Koha.
Comment 8 Martin Renvoize 2024-01-30 13:54:53 UTC
Created attachment 161636 [details] [review]
Bug 35248: Add unit tests for Koha::Booking relations

This patch adds unit tests for the relations introduced in the new
Koha::Booking class.

Test plan
1) Run t/db_dependent/Koha/Booking.t
Comment 9 Martin Renvoize 2024-01-30 17:09:44 UTC
Created attachment 161651 [details] [review]
Bug 35248: Add unit test for Koha::Item->bookings relation

This patch adds a simple unit test for the 'bookings' relation accessor
added to Koha::Item.

Test plan
1) Run t/db_dependant/Koha/Item.t
Comment 10 Martin Renvoize 2024-01-30 17:09:46 UTC
Created attachment 161652 [details] [review]
Bug 35248: Add unit tests for Koha::Item->find_booking

This patch adds basic unit tests for the Koha::Item->find_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t
Comment 11 Martin Renvoize 2024-01-30 17:09:49 UTC
Created attachment 161653 [details] [review]
Bug 35248: Unit tests for CanBookBeIssued

Whilst writing the test, I found a minor flaw in the logic and fixed
that in CanBookBeIssued at the same time.
Comment 12 Martin Renvoize 2024-01-30 17:09:51 UTC
Created attachment 161654 [details] [review]
Bug 35248: Add unit tests for Koha::Item->check_booking

This patch adds basic unit tests for the Koha::Item->check_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t
Comment 13 Martin Renvoize 2024-01-30 17:09:54 UTC
Created attachment 161655 [details] [review]
Bug 35248: Drop ->place_booking

These methods were introduced and used in an earlier iteration of the
code, they are no longer called from anywhere (the code in
Koha::Booking->store handles all cases instead) and thus I choose to
remove them rather than add unit tests for them.. They are simple
methods that could be re-introduced as required at a future date.
Comment 14 Martin Renvoize 2024-01-30 17:09:56 UTC
Created attachment 161656 [details] [review]
Bug 35248: Add test for Koha::Exceptions::Booking
Comment 15 Martin Renvoize 2024-01-30 17:09:59 UTC
Created attachment 161657 [details] [review]
Bug 35248: Remove Koha::Booking->intersects

Another method left behind from an earlier iteration.. not actually
called anywhere in the final submission in Koha.
Comment 16 Martin Renvoize 2024-01-30 17:10:02 UTC
Created attachment 161658 [details] [review]
Bug 35248: Add unit tests for Koha::Booking relations

This patch adds unit tests for the relations introduced in the new
Koha::Booking class.

Test plan
1) Run t/db_dependent/Koha/Booking.t
Comment 17 Martin Renvoize 2024-01-30 17:10:05 UTC
Created attachment 161659 [details] [review]
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
Comment 18 Martin Renvoize 2024-01-30 17:10:07 UTC
Created attachment 161660 [details] [review]
Bug 35248: Add unit tests for Koha::Bibilio->check_booking

This patch adds basic unit tests for Koha::Biblio->check_booking

Test plan
1) Run t/db_dependent/Koha/Biblio.t
Comment 19 Martin Renvoize 2024-02-07 16:18:28 UTC
There's still more to come here.. but I really think as people are starting to enhance and expand on bookings now we need these in sooner rather than later... setting to NSO to start getting eyes and I'll keep throwing more tests into further bugs.
Comment 20 Martin Renvoize 2024-02-07 16:40:55 UTC
Created attachment 161821 [details] [review]
Bug 35248: Add unit test for Koha::Item->bookings relation

This patch adds a simple unit test for the 'bookings' relation accessor
added to Koha::Item.

Test plan
1) Run t/db_dependant/Koha/Item.t
Comment 21 Martin Renvoize 2024-02-07 16:40:58 UTC
Created attachment 161822 [details] [review]
Bug 35248: Add unit tests for Koha::Item->find_booking

This patch adds basic unit tests for the Koha::Item->find_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t
Comment 22 Martin Renvoize 2024-02-07 16:41:00 UTC
Created attachment 161823 [details] [review]
Bug 35248: Unit tests for CanBookBeIssued

Whilst writing the test, I found a minor flaw in the logic and fixed
that in CanBookBeIssued at the same time.
Comment 23 Martin Renvoize 2024-02-07 16:41:03 UTC
Created attachment 161824 [details] [review]
Bug 35248: Add unit tests for Koha::Item->check_booking

This patch adds basic unit tests for the Koha::Item->check_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t
Comment 24 Martin Renvoize 2024-02-07 16:41:05 UTC
Created attachment 161825 [details] [review]
Bug 35248: Drop ->place_booking

These methods were introduced and used in an earlier iteration of the
code, they are no longer called from anywhere (the code in
Koha::Booking->store handles all cases instead) and thus I choose to
remove them rather than add unit tests for them.. They are simple
methods that could be re-introduced as required at a future date.
Comment 25 Martin Renvoize 2024-02-07 16:41:08 UTC
Created attachment 161826 [details] [review]
Bug 35248: Add test for Koha::Exceptions::Booking
Comment 26 Martin Renvoize 2024-02-07 16:41:10 UTC
Created attachment 161827 [details] [review]
Bug 35248: Remove Koha::Booking->intersects

Another method left behind from an earlier iteration.. not actually
called anywhere in the final submission in Koha.
Comment 27 Martin Renvoize 2024-02-07 16:41:13 UTC
Created attachment 161828 [details] [review]
Bug 35248: Add unit tests for Koha::Booking relations

This patch adds unit tests for the relations introduced in the new
Koha::Booking class.

Test plan
1) Run t/db_dependent/Koha/Booking.t
Comment 28 Martin Renvoize 2024-02-07 16:41:15 UTC
Created attachment 161829 [details] [review]
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
Comment 29 Martin Renvoize 2024-02-07 16:41:18 UTC
Created attachment 161830 [details] [review]
Bug 35248: Add unit tests for Koha::Bibilio->check_booking

This patch adds basic unit tests for Koha::Biblio->check_booking

Test plan
1) Run t/db_dependent/Koha/Biblio.t
Comment 30 Martin Renvoize 2024-02-07 16:41:20 UTC
Created attachment 161831 [details] [review]
Bug 35248: Add unit tests for Koha::Bibilio->bookable_items

This patch adds basic unit tests for Koha::Biblio->bookable_items

Test plan
1) Run t/db_dependent/Koha/Biblio.t
Comment 31 David Nind 2024-02-07 22:52:23 UTC
Created attachment 161861 [details] [review]
Bug 35248: Add unit test for Koha::Item->bookings relation

This patch adds a simple unit test for the 'bookings' relation accessor
added to Koha::Item.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 32 David Nind 2024-02-07 22:52:26 UTC
Created attachment 161862 [details] [review]
Bug 35248: Add unit tests for Koha::Item->find_booking

This patch adds basic unit tests for the Koha::Item->find_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 33 David Nind 2024-02-07 22:52:29 UTC
Created attachment 161863 [details] [review]
Bug 35248: Unit tests for CanBookBeIssued

Whilst writing the test, I found a minor flaw in the logic and fixed
that in CanBookBeIssued at the same time.

Signed-off-by: David Nind <david@davidnind.com>
Comment 34 David Nind 2024-02-07 22:52:32 UTC
Created attachment 161864 [details] [review]
Bug 35248: Add unit tests for Koha::Item->check_booking

This patch adds basic unit tests for the Koha::Item->check_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 35 David Nind 2024-02-07 22:52:43 UTC
Created attachment 161865 [details] [review]
Bug 35248: Drop ->place_booking

These methods were introduced and used in an earlier iteration of the
code, they are no longer called from anywhere (the code in
Koha::Booking->store handles all cases instead) and thus I choose to
remove them rather than add unit tests for them.. They are simple
methods that could be re-introduced as required at a future date.

Signed-off-by: David Nind <david@davidnind.com>
Comment 36 David Nind 2024-02-07 22:52:46 UTC
Created attachment 161866 [details] [review]
Bug 35248: Add test for Koha::Exceptions::Booking

Signed-off-by: David Nind <david@davidnind.com>
Comment 37 David Nind 2024-02-07 22:52:49 UTC
Created attachment 161867 [details] [review]
Bug 35248: Remove Koha::Booking->intersects

Another method left behind from an earlier iteration.. not actually
called anywhere in the final submission in Koha.

Signed-off-by: David Nind <david@davidnind.com>
Comment 38 David Nind 2024-02-07 22:52:53 UTC
Created attachment 161868 [details] [review]
Bug 35248: Add unit tests for Koha::Booking relations

This patch adds unit tests for the relations introduced in the new
Koha::Booking class.

Test plan
1) Run t/db_dependent/Koha/Booking.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 39 David Nind 2024-02-07 22:52:56 UTC
Created attachment 161869 [details] [review]
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>
Comment 40 David Nind 2024-02-07 22:52:59 UTC
Created attachment 161870 [details] [review]
Bug 35248: Add unit tests for Koha::Bibilio->check_booking

This patch adds basic unit tests for Koha::Biblio->check_booking

Test plan
1) Run t/db_dependent/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 41 David Nind 2024-02-07 22:53:02 UTC
Created attachment 161871 [details] [review]
Bug 35248: Add unit tests for Koha::Bibilio->bookable_items

This patch adds basic unit tests for Koha::Biblio->bookable_items

Test plan
1) Run t/db_dependent/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 42 David Nind 2024-02-07 22:53:56 UTC
I ran the tests before and after the patches were applied. I hope that is sufficient for testing.

Testing notes using koha-testing-docker:

1. Tests pass before and after patches applied:
   prove t/db_dependent/Circulation.t 
   prove t/Koha/Exceptions.t
   prove t/db_dependent/Koha/Item.t
   prove t/db_dependent/Koha/Booking.t (new tests)
   prove t/db_dependent/Koha/Biblio.t

2. Note: path to run the tests is t/db_dependent/Koha/Item.t (not db_dependant) for these patches:
  - Add unit test for Koha::Item->bookings relation
  - Add unit tests for Koha::Item->find_booking
  - Add unit tests for Koha::Item->check_booking
  - Add Koha::Biblio->bookings unit test
Comment 43 Martin Renvoize 2024-02-08 11:54:14 UTC
Created attachment 161890 [details] [review]
Bug 35248: Add tests for Koha::Booking->store

This patch adds tests for the Koha::Booking->store method.

Test plan
1) Run t/db_dependent/Koha/Booking.t and confirm they all pass
Comment 44 Martin Renvoize 2024-02-08 11:54:17 UTC
Created attachment 161891 [details] [review]
Bug 35248: Refactor - Move assign_item_for_booking

This routine really belongs inside Koha::Booking rather than
Koha::Biblio. This patch moves it there, renames with _ to highlight
it's private nature.

Test plan
1) Confirm that t/db_dependant/Koha/Booking.t still passes, specifically
   the 'store' test.
Comment 45 Martin Renvoize 2024-02-08 11:55:28 UTC
Thanks David, that's great :)

I've added a couple of further patches on top now too.. and there's one last one outstanding that I'm working on today.. resetting to assigned whilst I get that one done.. the more you look the more you see aye.
Comment 46 Martin Renvoize 2024-02-08 12:17:01 UTC
Created attachment 161893 [details] [review]
Bug 35248: Add tests for Koha::Booking->store

This patch adds tests for the Koha::Booking->store method.

Test plan
1) Run t/db_dependent/Koha/Booking.t and confirm they all pass
Comment 47 Martin Renvoize 2024-02-08 12:17:04 UTC
Created attachment 161894 [details] [review]
Bug 35248: Refactor - Move assign_item_for_booking

This routine really belongs inside Koha::Booking rather than
Koha::Biblio. This patch moves it there, renames with _ to highlight
it's private nature.

Test plan
1) Confirm that t/db_dependant/Koha/Booking.t still passes, specifically
   the 'store' test.
Comment 48 Martin Renvoize 2024-02-08 12:17:07 UTC
Created attachment 161895 [details] [review]
Bug 35248: Add tests for Koha::Booking->_assign_item_for_booking
Comment 49 Martin Renvoize 2024-02-08 12:19:33 UTC
Created attachment 161896 [details] [review]
Bug 35248: Add tests for Koha::Booking->_assign_item_for_booking
Comment 50 Martin Renvoize 2024-02-08 12:23:53 UTC
Created attachment 161897 [details] [review]
Bug 35248: Whitespace clean

Jonathan highlighted some trailing whitespace.. I only see a few cases
where a line only contains whitespace and I didn't see these caught by
the QA script at the time of submission.

Anyway, this removes the spaces
Comment 51 Nick Clemens (kidclamp) 2024-02-08 13:10:25 UTC
Created attachment 161898 [details] [review]
Bug 35248: Add unit test for Koha::Item->bookings relation

This patch adds a simple unit test for the 'bookings' relation accessor
added to Koha::Item.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 52 Nick Clemens (kidclamp) 2024-02-08 13:10:27 UTC
Created attachment 161899 [details] [review]
Bug 35248: Add unit tests for Koha::Item->find_booking

This patch adds basic unit tests for the Koha::Item->find_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 53 Nick Clemens (kidclamp) 2024-02-08 13:10:29 UTC
Created attachment 161900 [details] [review]
Bug 35248: Unit tests for CanBookBeIssued

Whilst writing the test, I found a minor flaw in the logic and fixed
that in CanBookBeIssued at the same time.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 54 Nick Clemens (kidclamp) 2024-02-08 13:10:31 UTC
Created attachment 161901 [details] [review]
Bug 35248: Add unit tests for Koha::Item->check_booking

This patch adds basic unit tests for the Koha::Item->check_booking
method.

Test plan
1) Run t/db_dependant/Koha/Item.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 55 Nick Clemens (kidclamp) 2024-02-08 13:10:34 UTC
Created attachment 161902 [details] [review]
Bug 35248: Drop ->place_booking

These methods were introduced and used in an earlier iteration of the
code, they are no longer called from anywhere (the code in
Koha::Booking->store handles all cases instead) and thus I choose to
remove them rather than add unit tests for them.. They are simple
methods that could be re-introduced as required at a future date.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 56 Nick Clemens (kidclamp) 2024-02-08 13:10:36 UTC
Created attachment 161903 [details] [review]
Bug 35248: Add test for Koha::Exceptions::Booking

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 57 Nick Clemens (kidclamp) 2024-02-08 13:10:38 UTC
Created attachment 161904 [details] [review]
Bug 35248: Remove Koha::Booking->intersects

Another method left behind from an earlier iteration.. not actually
called anywhere in the final submission in Koha.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 58 Nick Clemens (kidclamp) 2024-02-08 13:10:41 UTC
Created attachment 161905 [details] [review]
Bug 35248: Add unit tests for Koha::Booking relations

This patch adds unit tests for the relations introduced in the new
Koha::Booking class.

Test plan
1) Run t/db_dependent/Koha/Booking.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 59 Nick Clemens (kidclamp) 2024-02-08 13:10:43 UTC
Created attachment 161906 [details] [review]
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>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 60 Nick Clemens (kidclamp) 2024-02-08 13:10:45 UTC
Created attachment 161907 [details] [review]
Bug 35248: Add unit tests for Koha::Bibilio->check_booking

This patch adds basic unit tests for Koha::Biblio->check_booking

Test plan
1) Run t/db_dependent/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 61 Nick Clemens (kidclamp) 2024-02-08 13:10:47 UTC
Created attachment 161908 [details] [review]
Bug 35248: Add unit tests for Koha::Bibilio->bookable_items

This patch adds basic unit tests for Koha::Biblio->bookable_items

Test plan
1) Run t/db_dependent/Koha/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 62 Nick Clemens (kidclamp) 2024-02-08 13:10:50 UTC
Created attachment 161909 [details] [review]
Bug 35248: Add tests for Koha::Booking->store

This patch adds tests for the Koha::Booking->store method.

Test plan
1) Run t/db_dependent/Koha/Booking.t and confirm they all pass

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 63 Nick Clemens (kidclamp) 2024-02-08 13:10:52 UTC
Created attachment 161910 [details] [review]
Bug 35248: Refactor - Move assign_item_for_booking

This routine really belongs inside Koha::Booking rather than
Koha::Biblio. This patch moves it there, renames with _ to highlight
it's private nature.

Test plan
1) Confirm that t/db_dependant/Koha/Booking.t still passes, specifically
   the 'store' test.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 64 Nick Clemens (kidclamp) 2024-02-08 13:10:54 UTC
Created attachment 161911 [details] [review]
Bug 35248: Add tests for Koha::Booking->_assign_item_for_booking

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 65 Nick Clemens (kidclamp) 2024-02-08 13:10:57 UTC
Created attachment 161912 [details] [review]
Bug 35248: Whitespace clean

Jonathan highlighted some trailing whitespace.. I only see a few cases
where a line only contains whitespace and I didn't see these caught by
the QA script at the time of submission.

Anyway, this removes the spaces

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 66 Katrin Fischer 2024-03-07 13:53:40 UTC
Some trouble with applying the dependencies here - will revisit later.
Comment 67 Martin Renvoize 2024-03-08 08:24:58 UTC
I just applied the whole tree this morning against the current master and it was seamless.. not sure what problems your facing?
Comment 68 Katrin Fischer 2024-03-08 18:06:51 UTC
I looked into this again:  my problem is a "could not build fake ancestor" on bug 35782 right at the top of this tree. As it all still applies for you, maybe you could reattach the patches there for me?
Comment 69 Martin Renvoize 2024-03-11 08:07:10 UTC
Seems we're having sha1 issues.. branch pushed to https://github.com/PTFS-Europe/koha/tree/bug_35248
Comment 70 Katrin Fischer 2024-03-15 08:13:08 UTC
The last patch wouldn't apply or more, it doesn't appear to be needed anymore:

M	koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js
No changes -- Patch already applied.
Comment 71 Katrin Fischer 2024-03-15 08:39:55 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 72 Fridolin Somers 2024-03-18 09:02:46 UTC
Sure about dependancy with Bug 35788 ?
Can this be backported to 23.11.x ?
Comment 73 Martin Renvoize 2024-03-18 10:26:27 UTC
This should apply happily for 23.11.x Fridolin.  The dependency was there to ensure we pushed in the right order for master and to discourage others working on bookings code prior to the tests being present.

We aren't testing the code removed in the dependency bugs, but I think that's OK for 23.11.x at this stage.
Comment 74 Fridolin Somers 2024-03-19 08:03:44 UTC
Pushed to 23.11.x for 23.11.04
Comment 75 Lucas Gass 2024-03-19 21:15:16 UTC
Missing 23.05.x dependencies, no backport.