Commit Graph

427 Commits

Author SHA1 Message Date
Hayley Mapley d0facd2b73 Bug 24673 (18.11.x U18 follow-up): Fixing t/db_dependent/Koha/XSLT/Security.t
The test t/db_dependent/Koha/XSLT/Security.t failed on Jenkins for U18
when this bug's patches were backported, due to it returning a different
IO error message for XSLT.

This patch adds a condition to the regex which matches both messages:
'Failed to load external entity' and 'Failed to load HTTP resource'

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
2020-04-14 16:00:40 +12:00
Marcel de Rooy 610a6cf78b Bug 23290: [RMaint version] Mitigate XML/XSLT vulnerabilities
This is a squashed version for backporting to stable branches.
IMPORTANT: It does not move XSLT_Handler to XSLT/Base as in master.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d8bf40281b)

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
2020-02-24 09:10:06 +13:00
Jonathan Druart 70d1f0a1ba Bug 14759: Add test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit ad92c14058)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7ad9807353)

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
2020-02-21 10:07:08 +13:00
Lari Taskula c3ad074be4 Bug 24016: Add a failing test for overwrite-able manager_id in Koha::Patron::Message
To test:
1. prove t/db_dependent/Koha/Patron/Messages.t
2. Observe failure

t/db_dependent/Koha/Patron/Messages.t .. 2/12
   Failed test 'Manager id should be overwrite-able even if defined in userenv'
   at t/db_dependent/Koha/Patron/Messages.t line 90.
          got: '1100'
     expected: '1101'
 Looks like you failed 1 test of 12.
t/db_dependent/Koha/Patron/Messages.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/12 subtests

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit c74820c227)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3d73723a9f)

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
2020-02-20 15:03:07 +13:00
Jonathan Druart e11243cf04 Bug 24213: Add tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit d3462a97cc)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f45c4b8f3a)

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
2020-02-18 15:29:51 +13:00
Tomas Cohen Arazi d63d023a2a Bug 24191: Regression tests
This patch adds missing tests for calling objects.search with
non-existent column names for sorting, that should be mapped using
to_model for that matter.

Tests should fail as there's no current use of to_model for building the
order_by portion of the query.

Sponsored-by: ByWater Solutions
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit f38519b063)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 99ad6cac30)
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
2020-01-10 10:15:09 +13:00
Ere Maijala b94ca526b8 Bug 23089: Fix QueryBuilder tests.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit cce9d03bf9)
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
2019-12-18 14:05:11 +13:00
Kyle M Hall 5a7bf6bbec Bug 23688: System preference uppercasesurnames broken by typo
In the process of moving this feature from memberentry.pl to Patron.pm, the 's' on uppercasesurnames was dropped, breaking the feature.

Test Plan:
1) Test uppercasesurnames, note it does not work
2) Apply this patch
3) Test uppercasesurnames, note it works now!

Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 62ad053894)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0c9c78341b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2019-11-13 22:41:18 +00:00
Fridolin Somers b77ba4981c Bug 23004: Unit test
Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit b26c2a1863)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c67f4ce30a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2019-10-17 00:04:42 +00:00
Ere Maijala 22585ec127 Bug 22524: Fix publication date and year search with Elasticsearch
Also fixes the mappings.yaml to use correct field name (left over issue from bug 19575), so reset mappings and reindex before testing.

Test plan:
1. Reset mappings and reindex biblios.
2. Check that tests in t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t pass.
3. Try that all of the following year range type work in publication date search and year limit in advanced search:
yyyy
yyyy-yyyy
-yyyy
yyyy-

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 2293e6597c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d21a1fb964)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2019-08-31 03:35:36 +00:00
Mark Tompsett e4c7906dbd Bug 23199: Added tests for Koha::Patron
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit e53bed5375)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 05dcd8489c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2019-08-02 20:15:59 +00:00
Nick Clemens 480ce53dd8 Bug 23077: Fix import of cardnumber 0
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 9796f5adb3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit dd91300c04)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2019-07-31 18:23:00 +00:00
Nick Clemens 225c3ba5ed Bug 23077: Unit tests
prove -v t/db_dependent/Koha/Patrons/Import.t

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 51bfa2ce28)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit feaaa75f15)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2019-07-31 18:22:30 +00:00
Mark Tompsett 47468fe93c Bug 23151: (follow-up) tweaked tests
This forces the tests to use the new changed_fields
field.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 5c5a261e4e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8a52db3b2e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2019-07-22 23:58:36 +00:00
Jonathan Druart 68bd557329 Bug 23151: Add tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 286ffd5f2f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d08367c9aa)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2019-07-22 23:58:20 +00:00
Jonathan Druart 12cb120742
Bug 11853: Add tests
Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 735d23c299)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-05-24 14:45:27 +01:00
Martin Renvoize d32f129679
Bug 22899: (QA follow-up) Change accessor name
This patch changes pending_hold to has_pending_hold to signify that
we're returning a boolean and not a Koha::Hold object.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 5c81d98621)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-05-24 14:36:41 +01:00
Nick Clemens 8e4ea14f93
Bug 22899: Add pending_hold method to Koha::Item
To test:
 1 - Enable course reserves
 2 - Create a course
 3 - Add an item to the course
 4 - Attempt to view the course on the OPAC
 5 - Internal Server Error
 6 - Apply patch
 7 - Add an item to the holds queue by placing a hold and  running holds queue builder or:
     INSERT INTO tmp_holdsqueue (itemnumber) VALUES (###);
 8 - View the course page, note item appears 'Pending hold'
 9 - Remove the holdsqueue line
10 - View the course page, note item appears 'Available'
11 - prove -v t/db_dependent/Koha/Item.t

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
I see Jonathan's comments about small improvements, but will sign off as
everything works as expected here.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit f21ebad7d2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-05-24 14:34:23 +01:00
Jonathan Druart 3f99fb0c4c
Bug 21671: Prevent Modifications.t to fail randomly
If repeatable is set to 0 by TestBuilder, the tests will fail with:
t/db_dependent/Koha/Patron/Modifications.t .. 1/6     # Looks like you planned 20 tests but ran 9.

 #   Failed test 'approve tests'
 #   at t/db_dependent/Koha/Patron/Modifications.t line 259.
[repeatable not set for attribute type and tried to add a new attribute for the same code]# Looks like your test exited with 255 just after 5.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 914f23970d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-05-08 16:41:26 +01:00
Ere Maijala e2aa81da2c
Bug 22413: Improve query string and desc creation for Elasticsearch
Test plan:

After each of the following steps, verify that the results and query description looks ok.

1. Do a simple keyword query
2. Change sort order
3. Click a facet
4. Do an advanced search with title and author
5. Change sort order
6. Click a facet

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marjorie <marjorie.barry-vila@collecto.ca>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit aba8b130f8)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-04-26 16:24:15 +01:00
Josef Moravec ddd6d66f09
Bug 22451: Update test
Test plan:
prove t/db_dependent/Koha/Template/Plugin/Asset.t

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit be3c2abbdc)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-04-25 14:28:18 +01:00
Nick Clemens 07b8478a19
Bug 22541: Invoice adjustments should show invoice number and include link on ordered.pl and spent.pl
To test:
 1 - Find a vendor in acquisitions
 2 - Click 'receive shipment'
 3 - Create an invoice
 4 - Click 'Finish receiving'
 5 - Add an adjustment that encumbers while open and update adjustments
 6 - Go to acqui-home and click on the ordered total for the fund with the adjustment
 7 - Note the invoice adjustment shows the invoice id and does not link
 8 - Add another invoice and another adjustment, but close the invoice this time
 9 - Go to acqui-home and click on the spent total for the fund with the adjustment
10 - Note the invoice adjustment shows the invoice id and does not link
11 - Apply patch
12 - Visit the spent and ordered pages and note the adjustments show invoicenumber and are links
13 - prove -v t/db_dependent/Koha/Acquisition/Invoice/Adjustments.t

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 3c2ce5df6f)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-04-15 13:07:34 +01:00
Ere Maijala 8f8bcbbc0d
Bug 22295: Make Elasticsearch query builder group multi-term queries
Test plan:

1. Do an advanced search for
Title = new
AND
Title = york
2. Verify that the results match an advanced search for:
Title = new york
3. Verify that tests in t/db_dependent/Koha/SearchEngine/Elasticsearch still pass

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit e90cb16d79)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-04-15 12:30:04 +01:00
Jonathan Druart ec27c57240
Bug 22390: Never copy items if original order has been created from a subscription
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Tiny change to the code comment: serial => subscription order

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit d6122ff78d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-04-15 12:25:12 +01:00
Jonathan Druart 290d2376a2
Bug 22390: (bug 15184 follow-up) Use aqorders.subscriptionid instead of biblio.serial
It seems that we made a wrong assumption on bug 15184, see
  commit d658cb6f7e
  Bug 15184: Do copy items for not a serial OR if items are created on ordering

To know if an order has been created from a subscription we should check
$order->subscriptionid instead of the $biblio->serial flag

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit ec78d0cddb)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-04-15 12:24:50 +01:00
Tomas Cohen Arazi 2ab1ec967b
Bug 21846: Add Koha::Tags::Approval(s) and Koha::Tags::Index(es)
In order to avoid writing the tests using plain DBIC which would later
need to be replaced by a Koha::Object-based counterpart, I introduce
this stub classes.

Stub tests are added as well.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Tags.t \
          t/db_dependent/Koha/Tags/Approvals.t \
          t/db_dependent/Koha/Tags/Indexes.t
=> SUCCESS: Tests pass
- Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 6c86de628d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-03-19 09:57:07 +00:00
root ce578a9aca
Bug 19575: Rebase and fix tests
This patch lower cases the sort by fields to normalize checking them and adjusts
some existing tests to meet the new expectations.

The regex for splitting terms has been moved into a subroutine so that adjustment was made

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit c2061adc8b)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-03-05 14:51:27 +00:00
David Gustafsson 68b129e0c4
Bug 19575: Use canonical field names and resolve aliased fields
Adjust elastic search mappings to more closely match Zebra equivalents
resolving serveral issues with coded Zebra searches in templates and
sorting of search results in UI. Also make field names in search strings
case insensitive to accept case variations in template links and user input.

Sponsored-by: Gothenburg University Library

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 6d53910f0c)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-03-05 14:50:59 +00:00
Martin Renvoize 6643dc2a94
Bug 21692: (QA follow-up) Enhance test for new
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 569c64252e)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-02-26 09:31:23 +00:00
Jasmine Amohia d0b51ad0f4
Bug 21692: created a test for Koha::Account->new
Test plan:
1) Run test for /Koha/Account.t and confirm that all tests were
successful

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 34c36a32a0)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-02-26 09:25:18 +00:00
Jonathan Druart 111ddbfa57
Bug 22386: Remove debug statements
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 25006c04da)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-02-26 09:21:19 +00:00
Nick Clemens d6ca920313
Bug 22386: Unit tests
Signed-off-by: Devlyn Courtier <dcourtier@hccc.edu>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 9f27a63b9a)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-02-26 09:20:45 +00:00
Marcel de Rooy 45e20ab696
Bug 21798: (QA follow-up) Fix Biblios.t
Global symbol "$bibnum" requires explicit package name

Test plan:
Run test

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 94e64d3558)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-02-25 14:46:07 +00:00
Jonathan Druart c76509d723
Bug 21798: replace gimme_a_biblio with build_sample_biblio
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 2b76548770)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-02-25 14:45:54 +00:00
Jonathan Druart 4c134df529
Bug 21798: Unify the creation of bibliographic record in tests
Using the newly created subroutine

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 9ba6125f72)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-02-25 14:45:10 +00:00
Martin Renvoize 413f34ba24
Bug 22254: Correction to datehandling in test
Adding 13 months is not always the same as adding 1 month and then
adding 12 months in DateTime maths.  This patch rectified the test
to match the correct behaviour in koha.

Test plan.

1) Modify the test (around line 268) to test against the suspect
   leap date of 2019-01-31 and watch the test fail.
2) Apply the patch (which also adds this modification to test
   for such a leap date) and watch the test now pass.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 1da0ba48b6)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-02-11 13:40:29 +00:00
Jonathan Druart 0582bd25d8
Bug 21610: Add tests
Adding few tests to Koha/Object.t in order to highlight what we are
trying to fix.

Note that Koha::ItemType->store was wrong for notforloan, the default
value should be null
    `notforloan` smallint(6) DEFAULT NULL,
but the previous fix (bug 21599) made it default to '0'

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 9330deee55)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-02-04 11:12:05 +00:00
Tomas Cohen Arazi 18d934799f
Bug 22051: Unit tests
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 0ce4ccdcee)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-31 17:13:40 +00:00
Tomas Cohen Arazi 170ac6bbf3
Bug 22047: Unit tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 983c1193fa)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-31 16:48:03 +00:00
Lari Taskula 71495e2f6f
Bug 7614: Add a new method Koha::Libraries->pickup_locations
This patch adds a new method, Koha::Libraries->pickup_locations. This method
takes either an item or a biblio as a parameter, and returns the list of
acceptable pickup locations by considering libraries' configuration to act
as a pickup location as well as any branch transfer limits that may apply.

To test:
1. prove t/db_dependent/Koha/Libraries.t

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 2101d0af00)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-31 16:30:43 +00:00
Jonathan Druart 4d3510f89c
Bug 22006: Add tests
Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 58f04600f0)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-23 12:47:34 +00:00
Ere Maijala 66e041fece
Bug 21084: Fix automatic truncation in authority search
- Makes token splitting work like in biblio search
- Only adds right hand truncation since that's what Zebra also does
- Only adds truncation if the token is not a phrase and ends in a word character
- Adds tests to existing and new QueryBuilder functions

Test plan:

1. Create an authority record for "Duck, Donald"
2. Try contains type authority searches with the following terms and make sure they find the record:
Duck, Donald
donald duck
don duck
"Duck, Donald"
3. Make sure the following search works but does not find anything:
"Duck, Don"

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 0d9a42b492)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-23 12:43:33 +00:00
Tomas Cohen Arazi a59826288b
Bug 22107: Make tests use a simpler class, with no FK
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 528e09cf15)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-14 14:29:36 +00:00
Tomas Cohen Arazi 9b6b80488a
Bug 21912: (QA follow-up) Do not delete existing patrons
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 8e6c789255)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-14 14:08:59 +00:00
Tomas Cohen Arazi 464dcd7d9e
Bug 21912: Add tests for Koha::Objects->search
This patch adds simple tests for the current behaviour. Specifically the
return values in both scalar and list context.

To test:
- Apply this patch
- Run:
  $ prove t/db_dependent/Koha/Objects.t
=> SUCCESS: Tests pass
- Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 7669697732)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-14 14:08:38 +00:00
Tomas Cohen Arazi 9f88e1aa1e
Bug 22059: regression tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 3ef3ecfe99)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-10 13:24:46 +00:00
Tomas Cohen Arazi 5cc46f9b9c
Bug 21909: Unit tests
This patch introduces regression tests for the behaviour to be
introduced. Both outstanding_credits and outstanding_debits methods
should return a Koha::Account::Lines object in scalar context, and a
list of Koha::Account::Line objects in list context.

To test:
- Apply this patch
- Run
  $ kshell
 k$ prove t/db_dependent/Koha/Account.t
=> FAIL: The current behaviour doesn't match the described

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 85c474e597)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-07 15:00:39 +00:00
Jonathan Druart 336fedc15d
Bug 21817: Centralize the mock of userenv from tests
This patch adds a new method mock_userenv from t::lib::Mocks in order to
simplify the mock of the userenv.

Test plan:
prove all the test files modified by this patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit ca124b5c14)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-01-07 14:49:50 +00:00
Jonathan Druart 554cee5b3c
Bug 21065: Add tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 09ef91653b)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2018-12-20 09:29:02 +00:00
Jonathan Druart 10148dc26b
Bug 14334: Remove AutoCommit from tests
And use a DBIx transaction instead.

Test plan:
prove that the test files modified by this patch are passing

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 64242cabea)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2018-12-17 12:08:58 +00:00