Commit graph

5946 commits

Author SHA1 Message Date
511ae8298e
Bug 31120: Add unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-27 10:03:12 -03:00
24b7675dac
Bug 29697: Fix t/db_dependent/Search.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-25 10:16:48 -03:00
1201d39cd6
Bug 29697: Fix t/Search.t
#   Failed test 'No tests run for subtest "searchResults PassItemMarcToXSLT test"'
 #   at t/Search.t line 208.
 Undefined subroutine &C4::Biblio::EmbedItemsInMarcBiblio called at t/Search.t line 194.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-25 09:33:36 -03:00
f275de1f4f
Bug 29697: Replace some missing occurrences
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-25 09:30:30 -03:00
9d1a2f27cf
Bug 29697: Fix tests
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 15:24:11 -03:00
45de338715
Bug 29697: Use flag embed_items
Includes:
    Bug 29697: (follow-up) Use flag embed_items

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 15:24:11 -03:00
0a37e8f7fd
Bug 29697: Remove GetHiddenItemnumbers
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

JD amended patch:
-    my @items        = $biblio->items->filter_by_visible_in_opac({ patron => $logged_in_user })->unblessed;
-    foreach my $item (@items) {
+    my $items        = $biblio->items->filter_by_visible_in_opac({ patron => $logged_in_user })->unblessed;
+    foreach my $item (@$items) {

-    for my $itm (@items) {
+    for my $itm (@$items) {

-    $dat->{ITEM_RESULTS}   = \@items;
+    $dat->{ITEM_RESULTS}   = $items;

-        @items_to_show = Koha::Items->search( { itemnumbers => [ map { $_->{itemnumber} } @all_items ] } )
-                                    ->filter_by_visible_in_opac( { patron => $patron } );
+        @items_to_show = Koha::Items->search( { itemnumber => [ map { $_->{itemnumber} } @all_items ] } )
+                                    ->filter_by_visible_in_opac( { patron => $patron } )->as_list;

-            my @items_to_show = $items->filter_by_visible_in_opac({ opac => 1, patron => $patron });
+            my @items_to_show = $items->filter_by_visible_in_opac({ opac => 1, patron => $patron })->as_list;

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 15:24:11 -03:00
70d61d80fb
Bug 29697: Replace GetMarcBiblio occurrences with $biblio->metadata->record
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

JD Amended patch:
-# FIXME Special case here

-    print "Biblio not found\n,";
+    print "Biblio not found\n";

- my $biblio = Koha::Biblio->find($hostbiblionumber);
+ my $biblio = Koha::Biblios->find($hostbiblionumber);

Rebased-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 15:24:11 -03:00
e6947b7408
Bug 15187: (QA follow-up) Fix test permissions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 15:11:58 -03:00
058d411643
Bug 15187: (QA follow-up) Add unit test
This patch adds a unit test for the newly introduced filter.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 15:09:46 -03:00
d04728f805
Bug 30678: (follow-up) Add oclc_number routine and friends
As requested by QA, we should match the orgcode.
Adding a few small routines in a Util module.

Test plan:
Run t/Koha/Util/MARC.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 14:58:11 -03:00
467b444c7e
Bug 30838: (QA follow-up) Add unit tests
Two tests added, one in t/db_dependent/Circulation.t to catch the
initial setting of to_address at enqueue time and a second in
t/db_dependent/Letters.t to catch the correcting at send time.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 14:46:10 -03:00
f0685f0f40
Bug 31086: (QA follow-up) Add unit tests
This patch adds the unit tests for the change to Koha::Hold::store.

We test for and catch the exception introduced for both the create and
update cases.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 14:19:18 -03:00
bdddc7ee0a
Bug 31086: (QA follow-up) Fix failing tests
This test was missed first time around, branchcode needed adding to all
the calls to AddReserve.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 14:19:18 -03:00
bf2a9b5279
Bug 31086: Update existing unit tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 14:19:17 -03:00
4ce3a882a6
Bug 31128: Unit tests
This patch adds unit tests for the new effective_not_for_loan_status
which I add to the items api responses in this patchset.

Test plan
1) Run the unit test without applying the next commit, it should fail
2) RUn the test again after applying the next commit, it should pass

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 11:32:21 -03:00
8b957a69d4
Bug 31202: Don't remove optional SIP fields with a value of "0"
If the value of a SIP field is "0", that evaluates to false, so any calls to maybe_add with a value of "0" will not get added to the SIP response message.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/SIP/Message.t

Signed-off-by: Michal Urban <michalurban177@gmail.com>
JK: Adjust commit title

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-21 15:55:56 -03:00
bf32471053
Bug 25449: (QA follow-up) Fix basic_workflow.t
Now that we have made item.itype a required field, we need to ensure we
set it for the corresponding selenium test.. this wasn't entirely easy
as the html select is hidden by select2. I had to find the select2 span,
trigger a click event to open it and then find and click an option.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-21 09:40:46 -03:00
0800662227
Bug 25449: Fix basic_workflow.t
We need to create an itemtype for the biblio, then the item form will
have 942$c prefilled by default

STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...}
        /usr/share/perl5/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
        (eval 1726):1 in Selenium::Remote::Driver::__ANON__
        (eval 1728):2 in Selenium::Remote::Driver::__ANON__
        /usr/share/perl5/Selenium/Remote/Driver.pm:953 in Selenium::Remote::Driver::_execute_command
        t/db_dependent/selenium/basic_workflow.t:224 in Selenium::Remote::Driver::get_title

Error while executing command: unexpected alert open: Dismissed user prompt dialog: Form not submitted because of the following problem(s)
------------------------------------------------------------------------------------

- 1 mandatory fields empty (highlighted) at /usr/share/perl5/Selenium/Remote/Driver.pm line 411.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-21 09:40:46 -03:00
ed83d77445
Bug 31201: Prevent Pseudonymization.t to fail
It's failing if selenium/patrons_search.t failed before, they are using
the same code and the selenium tests didn't clean correctly

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-21 09:39:28 -03:00
d24cb97b06
Bug 31179: (QA follow-up) Set field as hidden for tests
We want the tests to pass in the case where field is set to visibile in Koha

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-20 09:04:59 -03:00
b90787d5c8
Bug 31179: Don't copy invisible subfields when duplicating items
Duplicate item is intended to duplicate the visible cataloging fields of an item, however,
currently it is duplicating the complete internal record of the item

To recreate:
1 - find an item in Koha staff client, copy the barcode
2 - Issue this item to a patron
3 - Return to the record
4 - Edit items
5 - Click 'Actions->Duplicate' for the item in question
6 - Save the item
7 - Note in the items table above for that 'Total checkouts' 'Due date'
 etc. have not been copied to new item

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-20 09:04:58 -03:00
9288addef0
Bug 30933: Unit tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-20 09:04:07 -03:00
773779e792
Bug 30933: (follow-up) Consolidate transfer checks
Adding shelf->cannot_be_transferred with unit tests.

Note: This follow-up actually refers to comment42 on the
preceding report 25498.
Furthermore, we could still improve later on using error code
more effectively (adding codes). Here we concentrate on moving
the checks to module level.

Test plan:
Run t/db_dependent/Virtualshelves.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-20 09:04:07 -03:00
d5ba2b1c4f
Bug 30933: Change for patron->delete
Test plan:
Run t/db_dependent/Koha/Patrons.t
Set pref ListOwnershipUponPatronDeletion to transfer.
Set pref ListOwnerDesignated to some valid borrowernumber.
Pick a user with public or shared list, delete from interface.
Pick a user with public or shared list, delete by script. (*)
Verify in both cases that new list owner is the designated one.

(*) Tip: Create another branch. Move the patron to be deleted to that
branch. And delete by script with:
    misc/cronjobs/delete_patons.pl -c -v -library YOUR_CODE

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-20 09:04:06 -03:00
60a4f1c84a
Bug 11889: (follow-up) We did not need get_shared_shelves after all
Test plan:
Run t/db_dependent/Virtualshelves.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-19 11:00:16 -03:00
aff32dd6dd
Bug 11889: (follow-up) Get rid of FIXME in Koha::Patron
Instead of get_lists, I added ->virtualshelves.

I removed the addition of the suffix to the shelf name here; if we
really want that (doubts), we should do it pref based. Removing a
staff member with public lists would result in weird names with
shelf numbers on the OPAC. (Should be very easy to restore.)

Used this opportunity to refactor the patron->delete subtest a bit:
switching to build_object, removing the 'retrieved patrons',
differentiating between staff patron and patron for sharing,
adding a few tests.

Test plan:
Enable transfer ownership. Delete a patron with lists in interface.
Check what happened.
Run t/db_dependent/Koha/Patrons.t.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-19 11:00:16 -03:00
1d1432cfb5
Bug 11889: (QA follow-up) Fix tests
We need some changes for 28959 changing category to public.
Added the userenv mocking.

Note: A follow-up does a bit more refactoring here. But they
should pass at least now.

Test plan:
Run t/db_dependent/Virtualshelves.t
Run t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-19 11:00:16 -03:00
Aleisha Amohia
5e544116c8
Bug 11889: (follow-up) Tests and new get_shared_shelves
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
This is a manual reconstruction of an older patch, that git
did not want to apply anymore (sha trouble etc.)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-19 11:00:15 -03:00
fd7652255c
Bug 27683: Unit test for GetAnalyticsCount
Run prove t/db_dependent/Items/GetAnalyticsCount.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 18:52:07 -03:00
Michal Urban
b4a9edc83f
Bug 30447: Unit tests
Added tests to ensure that Koha::Holds->get_items_that_can_fill returns items with datecancelled and datearrived
Added test for correct number of items for each call of "get_items_that_fill"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 17:50:14 -03:00
6ca908816f
Bug 29105: Unit test
This patch adds a unit test for the addition of effective_item_type_id
to the items responses.

Test plan
1) Run the unit test prior to applying the second patch and confirm it
   fails
2) Apply the second patch and confirm the unit test now passes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 14:41:25 -03:00
73ca6e2f57
Bug 31106: Unit tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 14:37:35 -03:00
f8f9231562
Bug 30882: (QA follow-up) Fix tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 14:36:28 -03:00
ecd91d6089
Bug 31069: Remove ExplodedTerms dependency on templates
This patch removes the use of templates and CGI in ExplodedTerms by using the
Koha::I18N library.

The functionality on the package is too simple, and messing with the
template paths complexity on the tests was too much, given we have a
nice way to have translatable strings at the package level.

This patch does that, and cleans up the test file as well, that required
complex template and CGI mocking to run properly.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/SuggestionEngine_ExplodedTerms.t
=> FAIL: It fails in master
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass
4. Follow the original test plan
=> SUCCESS: Things work
5. Enjoy the rest of the day and forget this ever happened

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 12:37:35 -03:00
295987a061
Bug 29632: Unit tests
This patch adds unit tests, as well as changing existing test to use a mock
and read the data as passed in tests, rather than relying on what exists in
the DB

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 11:21:47 -03:00
7b21fb020b
Bug 29094: Adding hold via SIP should check if patron can hold item first
When placing holds via SIP2, there is no holdability check. This seems very incorrect.

Test Plan:
1) Apply this patch
2) prove -r t/db_dependent/SIP

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 10:24:58 -03:00
318bb17d58
Bug 31134: Mock EdifactLSQ for t/Edifact.t
This patch adds a mock for the EdifactLSQ preference so we can
consistently pass when a database is not available.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 10:20:44 -03:00
083769164b
Bug 31139: Fix basic_workflow.t
Error while executing command: element not interactable: Element <input id="tag_952_subfield_w_810691" class="input_marceditor items.replacementpricedate noEnterSubmit flatpickr-input" name="items.replacementpricedate" type="hidden"> is not reachable by keyboard at /usr/share/perl5/Selenium/Remote/Driver.pm line 411.

Not sure if it's coming from bug 30717 or not. git bisect told me it was the culprit but we released 22.05 and it seems that we got basic_workflow.t green since then.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-15 10:47:52 -03:00
f22a40b8ba
Bug 28854: (QA follow-up) Remove duplicate key test
We now allow duplication of issue_id accross the return claims table (to
allow for the case where a bundle item has been loaned and thus multiple
claims can result from the same checkout.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-13 10:36:14 -03:00
6436629d86
Bug 28854: (QA follow-up)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-13 10:36:13 -03:00
2758b572ee
Bug 28854: Unit tests - chargelostitem
This patch adds unit tests for the changes to chargelositem to ensure
bundle charging works as expected setting the correct issue_id.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-13 10:35:50 -03:00
266bbe1234
Bug 28854: Unit test for AddReturn addition
This patch adds tests for the AddReturn change that adds an 'InBundle' message
to the return.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-13 10:35:49 -03:00
140dafd3f7
Bug 28854: Unit test for Koha::Item additions
This patch adds unit tests for the new methods added to Koha::Item
including:

* return_claim
* return_claims
* is_bundle
* in_bundle
* bundle_host
* bundle_items
* add_to_bundle
* remove_from_bundle

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

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-13 10:35:48 -03:00
b306cb47ce
Bug 31145: Supply defaults for vendors and funds
This is a convenience bug - when koha testing docker creates sample vendors and budgets there are small issues:

1 - The vendor website gets a random string - you can't edit the vendor without removing this
2 - The funds have random values for statistical categories, and you get empty dropdowns when choosing a fund in ordering

To test:
1 - Apply patch
2 - Restart all
3 - Edit 'My vendor'
4 - note webstie is empty and you can save without changing anythign
5 - Add order to basket for my vendor
6 - Confirm that when selecting a fund statistic 1 and statistic 2 remain as text input fields

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-13 10:35:16 -03:00
fdc933adb4
Bug 31133: Don't generate values for more than one FK
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-12 10:57:52 -03:00
56d79a483d
Bug 31104: Add a selenium test
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-12 10:46:35 -03:00
c0803a10fd
Bug 21978: Fix Selenium tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-12 10:23:41 -03:00
6361638407
Bug 24857: Delete item group when last item is deleted
To test:
1 - Find a record with an item gorup, or add a group
2 - Add an item to this group, ensure it is the only item in the group
3 - Delete the item
4 - Confirm the gorup was also deleted
5 - prove t/db_dependent/Koha/Biblio/ItemGroups.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-08 16:00:11 -03:00
35d5ec1a67
Bug 24857: Add Object Methods
To test:
1 - prove t/db_dependent/Koha/Biblio.t
2 - prove t/db_dependent/Koha/Item.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-08 15:59:59 -03:00