Commit Graph

2168 Commits

Author SHA1 Message Date
Marcel de Rooy 067c45ed30 Bug 18951: Adjust Isbd.t
Add schema calls.
Remove an unneeded AddBiblio call.

Test plan:
Run t/db_dependent/Biblio/Isbd.t

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

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 40c719a524)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit ce8ddbf8ea)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-16 22:59:16 +02:00
Marcel de Rooy 7f8b4e60ab Bug 18951: Create data for TransformKohaToMarc.t
Adding schema and caching statements.
Adjust it so that the Koha to MARC mappings are not assumed to be present,
but are created as needed.
Remove the mock on marcflavour. It is no longer needed.
Resolving a small typo.

Test plan:
Run t/db_dependent/Biblio/TransformKohaToMarc.t

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

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f839955db7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 36c3bbedfe)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-16 22:59:05 +02:00
Marcel de Rooy 82ec039de8 Bug 18951: Some t/Biblio tests are database dependent (git mv)
Move Isbd.t and TransformKohaToMarc.t to db_dependent.
Next patch will add a few adjustments too.

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

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 50bc4170ce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 216b13e51f)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-16 22:58:52 +02:00
Marcel de Rooy 89bf455529 Bug 18361: [SQUASHED FOR 16.11] Koha::Objects->find should accept composite primary keys
Changes the $id parameter to an array. (IssuingRule has three keys.)
The build_object method in TestBuilder.pm has been adjusted to pass
multiple primary key values to find.

Also adjusted the POD section to show more clearly that we accept
the same parameters as DBIx ResultSet does.

Test plan:
Run t/db_dependent/Koha/Object.t
Run t/db_dependent/Koha/Objects.t
Run t/db_dependent/TestBuilder.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Bug 18361: Additional tests for Koha::Objects->find

Adding a subtest find in t/db_dependent/Koha/Objects.t.

Test plan:
Run t/db_dependent/Koha/Objects.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

Bug 18361: (QA followup) Add tests for the no params case

This patch adds a test for the trivial case in which no param is passed
and the ->find method returns undef.

For completeness purposes.

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

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

Bug 18361: [QA Follow-up] Resolve warning on undef values supplied

The following warning was raised in Letters.t:
DBIx::Class::ResultSource::_minimal_valueset_satisfying_constraint():
NULL/undef values supplied for requested unique constraint 'primary' (NULL
values in column(s): 'id'). This is almost certainly not what you wanted,
though you can set DBIC_NULLABLE_KEY_NOWARN to disable this warning.

This warning is triggered by this line in C4/Letters.pm:
    Koha::SMS::Providers->find( $member->{'sms_provider_id'} );
As you already guessed, the sms_provider_id returns undef.

Resolved in sub find by testing if there are parameters and if so, they
should not be all undefined. (In most cases there will be only one
parameter; but this report is about composite keys.)

Added a trivial test case in Objects.t too.

Test plan:
Run t/db_dependent/Koha/Object.t
Run t/db_dependent/Koha/Objects.t
Run t/db_dependent/Letters.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
2017-08-16 22:58:34 +02:00
Katrin Fischer c2d2e915c9 Bug 18539 - Follow-up - RMaint missed a merge marker... 2017-08-16 22:38:57 +02:00
Jonathan Druart 12d8885eef Bug 18539: remove occurrence in ReNewSubscription.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ad7ff09b99)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 6e26bd0567)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-05 14:44:34 +02:00
Jonathan Druart c5b576135a Bug 18539: Forbid list context calls for Koha::Objects->find
Reading https://perlmaven.com/how-to-return-undef-from-a-function
this sound like the more correct behaviour.

Considering:
$template->param(
    stuff => Koha::Stuffs->find( $id ),
    foo   => 1,
);
without this patch, if the $id does not represent any rows in the DB,
stuff will be assigned to 'foo' and $foo will be undef in the template.
That can lead to very bad side-effects.

With this patch we make sure that it will never happen again.

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Marc Véron <veron@veron.ch>

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 15cbf14f4d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5a2604144f)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-05 14:43:58 +02:00
Marcel de Rooy 489794bbe9 Bug 18991: [QA Follow-up] Use schema txn_begin and txn_rollback
We also need just one rollback at the end here.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e5e5402f36)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 9908a18e92)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-01 07:54:28 +02:00
Lari Taskula 18d8784cf0 Bug 18991: Fix cleanup in t/db_dependent/Log.t
There is an action_logs entry via logaction() without transaction to be rolled
back in t/db_dependent/Log.t. This leaves an entry in action_logs after
the test is over.

To replicate:
1. prove t/db_dependent/Log.t
2. Observe a new entry in action_logs table

To test:
1. Apply patch
2. prove t/db_dependent/Log.t
3. Observe there are no new entries in action_logs

Signed-off-by: Marc Véron <veron@veron.ch>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f49f5a67d3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 2af6365fc6)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-01 07:54:14 +02:00
Marcel de Rooy 9aa31608ab Bug 18605: Remove TRUNCATE from C4/HoldsQueue.pm
Replaces TRUNCATE by DELETE, since truncate implicitly commits. We don't
need to do that here. (Would complicate testing it too.)
Fixes typo disablig.
Add a simple test to HoldsQueue.t.

Test plan:
Run t/db_dependent/HoldsQueue.t

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

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit db64c94953)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit bede0cc328)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-01 07:43:07 +02:00
Lari Taskula be80afb95b Bug 18977: Rollback branch in t/db_dependent/SIP/Message.t
To test:
1. Before applying patch, check the amount of branches in database
2. prove t/db_dependent/SIP/Message.t
3. See that a new branch is stored
4. Apply patch
5. prove t/db_dependent/SIP/Message.t
6. See that a new branch is no longer stored

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 139b66f656)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5b71a41505)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-01 07:40:23 +02:00
Jonathan Druart cbbb54fd9a Bug 18982: Remove data in the correct order
To respect FK

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6cb3abcbd9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 806357a8fc)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-01 07:21:25 +02:00
Jonathan Druart 87db7d92ac Bug 18982: Create a circ rule for the data we created
No need to have a default circ cule, we create one for the categorycode
and itemtype we are going to use.
The 3 checkouts will not be rejected (5 are allowed)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5b84987f28)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0f654af181)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-01 07:21:11 +02:00
Jonathan Druart 656081fb33 Bug 18982: Create a specific itemtype for these tests
No need to require rentalcharge=0 for all itemtypes, we create our own.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ca0568f583)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b1664900f3)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-01 07:20:59 +02:00
Jonathan Druart a7817b76bc Bug 18982: category.categorycode must be uppercase
Otherwise it is not selected in the dropdown list and the patron created
does not belong to this category

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 60478e6544)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 6eff769909)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-01 07:20:49 +02:00
Jonathan Druart cf82a24b96 Bug 18982: Use KOHA_INTRANET_URL instead of syspref staffClientBaseURL
That way we do not need to set the syspref, we can define it setting an
env var, like other tests.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 78d77163af)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0ec81e6248)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-08-01 07:20:26 +02:00
Jonathan Druart 9e10240b18 Bug 18572: Remove AddRenewal parameter
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 51e8b7bbc9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 3e8ea751de)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-28 01:27:56 +02:00
Nick Clemens 64a92f1bb6 Bug 18572 - QA Followup
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9b92d79817)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 132f957311)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-28 01:27:43 +02:00
Nick Clemens 88fba552c6 Bug 18572 - Improper branchcode set during OPAC renewal
To test:
1 - Set 'OpacRenewalBranch' to various settings
2 - Renew an item for a ptron under each setting
3 - Confirm action_log entries reflect the correct branch for each
secnario
4 - prove t/db_dependent/Circulation/issue.t

Signed-off-by: David Kuhn <techservspec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e9374dcf63)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d8722dde9b)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-28 01:24:07 +02:00
Nick Clemens c2786a1229 Bug 18826 - (QA Followup) Add mock SessionStorage to patrons.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a696843f82)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b15a3c1b5e)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-28 01:18:29 +02:00
Jonathan Druart 247a34970a Bug 18826: rollback transaction for api tests
The holds.t tests for the REST api do no rollback properly and modify
the DB (no cleanup).
This comes from a bug caused by SessionStorage = mysql (default)

The error is:
    "rollback ineffective with AutoCommit enabled"

Test plan:
  select count(*) from borrowers;
  prove t/db_dependent/api/v1/holds.t
  select count(*) from borrowers;
=> The number of entry must be the same before and after the tests have
been executed

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d5dc473382)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit da0ed1cba5)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-28 01:18:15 +02:00
Jonathan Druart 23c2f7bbba Bug 18910: Revert "Bug 18152: Add tests"
This reverts commit a807d7199e.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit dd60cd9635)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e501377694)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-28 01:15:52 +02:00
Jonathan Druart c9f332b0e1 Bug 18966: Do not deal with duplicate issue_id on checkin
Koha suffers of big bugs due to its history: When data are deleted, they are moved to another tables.
For instance issues and old_issues: when a checkin is done, it is moved to the old_issues table.
That leads to a main problem that is described on https://wiki.koha-community.org/wiki/DBMS_auto_increment_fix

However we tried first to fix the problem (for issues/old_issues) at code level on bug 18242.
The goal was to prevent data lost.
Data lost may happens in this case:
Check an item out (issue_id = 1)
Check an item in (issue_id = 1)
Restart MySQL (reset auto increment for issue_id to 1)
Check an item out (issue_id = 1)
Check an item in => BOOM, the issue_id is a PK in old_issues and the move fails.
Before bug 18242 the data were lost, we inserted the value into old_issues, which fails silently (because of RaiseError set to 0 in Koha::Database), then delete the row from issues.
That has been fixed using a transaction.

This patch introduced a regression we tried to fix on bug 18651 comment 0, the patron was charged even if the checkin was rejected.
A good way to fix that would have been to LOCK the tables:
1- Start a transaction
2- LOCK the table to make sure nobody will read id and avoid race conditions
3- Move the content from one table to the other, dealing with ids
4- UNLOCK the table
5- Commit the transaction
But there were problems using LOCK and DBIx::Class (See commit 905572910b - Do no LOCK/UNLOCK the table).

Finally the solution implemented is not acceptable for several reasons:
- batch checkins may fail
- issue_id will always stay out of sync (between issues and old_issues)
See 18651 comment 66.

Since the next stable releases are very soon, and we absolutely need to fix this problem, I am suggesting to:
1- Execute the move in a transaction to avoid data lost and reject the checkin if we face IDs dup
=> It will only reject 1 checkin (max is 1 * MySQL restart), no need to deal with race conditions,
2- Display a warning on the checkin page and link to a solution/explanation
3- Communicate as much as we can on the proper fix: Update auto increment values when the DBMS is restarted - https://wiki.koha-community.org/wiki/DBMS_auto_increment_fix
4- Display a warning on the about page for corrupted data (see bug 18931)
5- Write and make available a maintenance script to fix corrupted data (TODO LATER)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-28 01:14:36 +02:00
Baptiste Wojtkowski a5927551a0 Bug 18613: Add unit tests for getletter
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ad367a4700)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c0021af422)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-19 23:31:37 +02:00
Mark Tompsett e0bf7dc8d6 Bug 18748: Noisy t/db_dependent/AuthorisedValues.t
This noise is from a failure. This patch expands the delete
to 952$c for the ACQ framework as per comment #5.

TEST PLAN
---------

insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian, libopac, repeatable, mandatory, kohafield,tab,authorised_value,authtypecode,value_builder,isurl,hidden,frameworkcode,seealso,link,defaultvalue,maxlength) values (952,'c','Shelving location','Shelving location',0,0,'items.location',10,'LOC','','',0,0,'ACQ','','',null,9999);
-- this makes sure you have a pre-existing 952$c ACQ record.

prove t/db_dependent/AuthorisedValues.t
-- should have ugly message like in comment #0
apply patch
prove t/db_dependent/AuthorisedValues.t
-- should be green
run koha qa test tools

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 441f6fac33)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 97498a6a7b)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-19 23:23:03 +02:00
Marcel de Rooy 37c8278d73 Bug 18554: Adjust a few typos including responsability
typo responsability
typo defautl in authorities.pref
typo reveived in t/db_dependent/Acquisition.t
typo ;; in advance_notices.pl
typo Stopping in restart_indexer (koha-indexer)
typo instutitional in moremember.pl
typo Corretly (Biblio.t)
typo periodicy in help serials

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

Signed-off-by: Marc Véron <veron@veron.ch>

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 4e31223aa0)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-16 14:47:24 +02:00
Colin Campbell aefdb757bf Bug 18755: Allow empty passwords in Patron Info to return OK
With this patch a parameter 'allow_empty_passwords="1" can be added to a
login in the SIP configuration file to allow the behaviour as was normal
before the patch for bug 16610 was applied. Some sip clients rely on
this behaviour sending an empty password field when they wish to
validate to user but do not have the password.
If a password is supplied it will be validated

A test has been added to Message.t to confirm this behaviour

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ebb887e5c9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 459c144f2a)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-16 13:47:22 +02:00
Fridolin Somers 794061a947 Bug 18756 - add Unit Test
Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8b15c06440)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 40db2dcc38)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-07-15 19:57:42 +02:00
Marcel de Rooy 43ff7d25e5 Bug 18697: Final polishing
GetFictiveIssueNumber:
Returns undef instead of 0 for irregular frequencies. Also added to POD.
Removed unused variable $wkno.
Adding a return makes the if(unit) unneeded.
Replaced (a+b)/b by 1+a/b.

_delta_units:
Added a comment about its parameters.

GetFictiveIssueNumber.t:
Adjusted the tests for irregular frequencies accordingly.

Test plan:
[1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t
[2] Run t/db_dependent/Serials/GetNextDate.t

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4e9701c36a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1f530d55ec)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-29 22:38:49 +02:00
Marcel de Rooy 94704e9a5a Bug 18697: Adjusting unit tests for dayly serial frequencies
No changes were needed for GetNextDate.t.
In GetFictiveIssueNumber.t we add a subtest for daily frequencies.

Test plan:
[1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8eae966083)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit e911c0ccd7)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-29 22:37:13 +02:00
Marcel de Rooy db0a98f89c Bug 18697: Adjusting unit tests for weekly serial frequencies
Corrections and added unit tests following the changes of the first patch.

GetFictiveIssueNumber.t: New subtest for weekly frequencies.

GetNextDate.t: Correcting a few dates one day. If we use 2/week, we will
calculate an interval of 3 days and correct with 4 days at the end of
the cycle. The connection with firstacqui is not relevant anymore.

Test plan:
[1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t
[2] Run t/db_dependent/Serials/GetNextDate.t

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e25f4670f3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 2851d186f6)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-29 22:36:45 +02:00
Marcel de Rooy 3776f59601 Bug 18607: Adjusting unit tests for monthly serial frequencies
The changes in the first patch require some corrections as well as
additional test cases.

GetNextDate.t: Since the calculation for multiple issues per unit has
slightly changed, a few dates (day 15 or day 16) have been changed in the
unit test; when we use 2/month, the algorithm now always adds 15 days.
Added a few test descriptions in this regard too.

GetFictiveIssueNumber.t: Add the monthly subtest with two test cases. In
the first case we tests multiple units per issue, and in the second case
we test multiple issues per unit (month).

Test plan:
[1] Run t/db_dependent/Serials/GetFictiveIssueNumber.t
[2] Run t/db_dependent/Serials/GetNextDate.t

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 05a49035cc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 45c31333a8)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-29 22:33:40 +02:00
Marcel de Rooy c310e42869 Bug 18356: Extend GetNextDate.t, add GetFictiveIssueNumber.t (unit=year)
This patch deals with tests for yearly frequencies.

Adjust/extend GetNextDate.t:
[1] Adjust mixup of units/issues in a description.
[2] Add testing +2 years on 29-2 of leap year for freq 1 issue/2 years.
[3] Add tests for freq 9 issues/year.

Add GetFictiveIssueNumber.t:
[1] Two subtests are provided for irregular frequencies (very trivial) and
    for year frequencies (with four specific test cases).

Test plan:
[1] Run t/db_dependent/Serials/GetNextDate.t
[2] Run t/db_dependent/Serials/GetFictiveIssueNumber.t

Note: Without the second patch both tests should fail. This shows the need
of the adjustments in the second patch.

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 285f6bd945)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1d30b33e7e)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-29 22:27:06 +02:00
Mark Tompsett a38a6ba178 Bug 18807: t/db_dependent/www/batch.t fails
get() does not take two parameters. fixed.
prove and run koha qa test tools

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit da10c3169b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 15146ec292)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-28 00:09:57 +02:00
Jonathan Druart 7df38cc175 Bug 18807: Fix tests www/batch.t
Several things are wrong here:
1. It assumes that import_record_id is the biblionumber
=> Wrong, it is only true when the DB is empty and that the 2 AI equal 1
2. The encoding in the template is 'UTF-8', not 'utf8', it leaded to
  "stage-marc-import.pl: marc21record.mrc: Unexpected charset UTF-8, expecting utf8"
3. We did not test that the biblio was correctly imported

Test plan:
Make sure the tests now pass.
For the www tests you need to set the following env vars:
KOHA_USER, KOHA_PASS, KOHA_INTRANET_URL and KOHA_OPAC_URL

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 768c5758a2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 92fee49448)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-28 00:09:45 +02:00
Jonathan Druart 15da9aa0d0 Bug 18804: Add additional information to execute successfuly selenium tests
(cherry picked from commit 0f10528591)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8b0b8ca532)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-27 23:36:05 +02:00
Jonathan Druart 9c787039b2 Bug 18804: (bug 13501 follow-up) Fix add item form (select2)
Hard to say here, select2 adds so many elements that we need to ignore.
Here we just assume that input text with an id starting with
tag_952_subfield must be filled

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 8035a467f0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d5f1aca783)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-27 23:35:55 +02:00
Jonathan Druart 9cec7d146f Bug 18804: (bugs 16400,11088 follow-up) Update the "save category" elt selector
With bug 11088 and bug 16400 the submit node switched from:
  <input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" />
to:
  <button type="submit" name="save" onclick="return check_form_borrowers">
then finally to:
  <button class="btn btn-small" id="saverecord" type="submit" name="save" onclick="return check_form_borrowers();">

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 08ab41aa98)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit fe5c9a47b6)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-27 23:35:44 +02:00
Jonathan Druart b5106f8f10 Bug 18804: (bug 16286 follow-up) Update the "save category" elt selector
Bug 16286 replaced the submit node:
  <input type="button" value="Save" onclick="Check(this.form);" />
with
  <input type="submit" value="Save" />

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit a88f540ec1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 06aca0844b)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-27 23:35:27 +02:00
Jonathan Druart 928d21978e Bug 18804: Skip selenium tests if Selenium::Remote::Driver is not installed
We do not want these tests to fail if the module is not installed.
This module is not in the dependencies of Koha and it is good as it.
A developper who wants to use it will know what to do.
It is part of RM duties to make sure these tests pass

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 943a3a5c3a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c3c5642bb8)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-27 23:35:11 +02:00
Jonathan Druart 921f346233 Bug 18762: Remove some warnings from Search.t
Note that some are caused by CGI, see bug 18632

Test plan:
Confirm there are less warnings with this patch applied

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
(cherry picked from commit 6d78d7a610)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit f7bcec6464)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-21 08:17:27 +02:00
Jonathan Druart a5b9bbe042 Bug 18762: Remove a warning from History.t
Test plan:
  prove t/db_dependent/Search/History.t
should not display any warnings

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
(cherry picked from commit 15f9e830ec)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5c0e28d092)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-21 08:16:37 +02:00
Jonathan Druart 9e83bceff6 Bug 18761: Fix tests for AutomaticItemModificationByAge.t - clear cache
The mapping structure is cached and may be wrong if already populated.
We need to clear the cache when a framework is modified

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Works as described in test plan and passes QA tools.

(cherry picked from commit c3a1159161)
(cherry picked from commit a44c0f8271)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-15 22:22:42 +02:00
Marcel de Rooy 9eace51161 Bug 18601: OAI/Sets.t mangles data due to truncate in ModOAISetsBiblios
This patch replaces the TRUNCATE statement in ModOAISetsBiblios by a
DELETE statement. A truncate will cause an implicit commit and will
therefore commit the transaction started in the test script.

Also simplifying the module load in the test script.

Test plan:
Do not apply this patch and observe that biblio records are added to your
database by running t/db_dependent/OAI/Sets.t.
Apply this patch, run the test again and verify that it does no longer
add records to your biblio table.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e0444e8600)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 28928c6937)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-15 22:21:38 +02:00
Mark Tompsett 934043656a Bug 18773: Fix failing history.t test
changed get() to get_ok() and increased test count to match.
Now the master build will only fail on search_utf8.t

TEST PLAN
---------
assuming KOHA_CONF is set.
$ export KOHA_INTRANET_URL=...
$ export KOHA_OPAC_URL=...
$ prove -v t/db_dependent/www/history.t

run koha qa test tools

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Works correctly using text plan provided and passes QA tools.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 25bbc181c9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5c5290eb31)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-13 22:39:07 +02:00
Mark Tompsett d5561c8aae Bug 18411: Fix failing search_utf8.t tests
TEST PLAN
---------
export KOHA_INTRANET_URL=...
prove -v t/db_dependent/www/search_utf8.t

something like seen before failure:
t/db_dependent/www/search_utf8.t .. 9/66 Error GETing http://koha_16_11:8080/cgi-bin/koha/tools/background-job-progress.pl?jobID=741d649f9d4472fe75f30761ba2488c0: Bad Request at t/db_dependent/www/search_utf8.t line 170.

apply this patch
prove -v t/db_dependent/www/search_utf8.t

Now it is the marc staging that is failing.
And that is failing in master for me.
So, I don't think it is the test that is a problem at this point,
but the actual staged marc records process.

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
I'm not sure why you had problems. All 66 tests passed
after patch application and the patch also passes QA Tools.
I tested this patch on a brand new kohadevbox without issue.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit bd14d2db9c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1b228a9a29)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-13 22:38:38 +02:00
Tomas Cohen Arazi 08a2513df4 Bug 18767: Remove useless diags from GetDailyQuote.t
This tests print useless debugging info.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/db_dependent/Koha/GetDailyQuote.t
=> FAIL: Some output telling what is doing on each step is printed.
- Apply the patch
- Run
 k$ prove t/db_dependent/Koha/GetDailyQuote.t
=> SUCCESS: No output, YAY!
- Sign off :-D

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 78a9f39f9a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4def0870d8)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-13 08:01:21 +02:00
Jonathan Druart e2900e5c30 Bug 18759: (follow-up) Try to fix random failure from Circulation.t
If IndependentBranches, CanBookBeRenewed will set ITEMNOTSAMEBRANCH
or BORRNOTSAMEBRANCH flags, if the branches do not match.

(cherry picked from commit 1577460c71)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d45bc6ad53)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-13 07:44:25 +02:00
Jonathan Druart ac6f945f42 Bug 18759: Try to fix random failure from Circulation.t
Circulation.t is failing randomly on our CI
https://jenkins.koha-community.org/job/Koha_Master_D8/192/console

    #   Failed test at t/db_dependent/Circulation.t line 1147.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1152.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1156.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1170.
    #          got: '1'
    #     expected: '0'

    #   Failed test at t/db_dependent/Circulation.t line 1184.
    #          got: '1'
    #     expected: '0'
    # Looks like you failed 5 tests of 23.

Sometimes one of the alert or impossible flags is set.
This patch guesses that it's because of the 'restricted' value of the item that is evaluated to 1.
If it is not fixed by this patch, we will have more info next time (at least know
if alert or impossible is set).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
The fix is trivial. Using random data will lead to this situations. The good thing is that
it lets us spot places in which tests need more fine-grained data.

(cherry picked from commit 9a55f5783c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 178ecea260)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-13 07:43:23 +02:00
Nick Clemens 056b895223 Bug 18478 - Unit tests
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2017-06-05 22:14:36 +02:00