Commit graph

1285 commits

Author SHA1 Message Date
5e14748360 Bug 14456: (regression test) Holdings fields should be skipped by EmbedSeeFromHeadings
This patch introduces a regression test for the situation in which
an itemnumber on a record matches the authid of an authority record
and the current implementation of the EmbedSeeFromHeadings filter
wrongly includes new holding fields with authority data...

To test:
- Apply the patch
- Run:
  $ prove t/db_dependent/RecordProcessor_EmbedSeeFromHeadings.t
=> FAIL: The test 'Holdings fields not processed to introduce See-from heading'
   fails.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-07-24 13:39:53 -03:00
Tomas Cohen Arazi
b69beb2499 Bug 14167: (QA followup) use warn instead of just STDERR
This patch makes Koha::Logger use 'warn' instead of just printing
to STDERR. It introduces tests for this warnings too.

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-07-21 10:50:17 -03:00
c339b5e4cc Bug 14167: Add a unit test for Koha::Logger
Test plan:
Run the test.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-07-21 10:19:03 -03:00
Mark Tompsett
588f13e699 Bug 14121: Silence warnings t/db_dependent/Auth_with_cas.t
TEST PLAN
---------
1) $ prove t/db_dependent/Auth_with_cas.t
   -- CGI security warning
2) apply patch
3) $ prove t/db_dependent/Auth_with_cas.t
   -- no noise.
4) koha qa test tools

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Not able to reproduce the error on my setup, but the code
is a clear improvement over the previous version.
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-07-20 10:32:21 -03:00
1a8962f306 Bug 14494: Add some unit tests too for CalcDateDue
The second patch of this report made some changes to CalcDateDue.
We are adding some unit tests here.
See the commments on the third patch too.

Test plan:
Run t/db_dependent/Circulation_dateexpiry.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended patch: Set the number of tests for the second subtest (was
commented) and perltidy the second block.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-07-20 10:16:24 -03:00
Jonathan Druart
e0986f5a79 Bug 14494: Unit tests for CanBookBeIssued related to dateexpiry
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Moved the test on its own. Nicer than adding TestBuilder in the final part
of the test. No warnings/errors from TestBuilder, no dependency..

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-07-20 10:16:24 -03:00
Mark Tompsett
63427fce60 Bug 14428: Remove C4::Input
Jonathan Druart agreed that C4::Input is vestigial code that should be removed.
Here is how I checked. First I found where C4::Input was used. Then, I checked
what functions are in the package: just checkdigit. Then, I confirmed that
checkdigit is not used at all in any acquisition, administration, or member
related perl scripts. Lastly, I took a look at our supposed test file for the
package. It was painfully sparse.

As such, this patch removes the test file and the package file, and removes
C4::Input references from these six files:
- acqui/addorderiso2709.pl
- acqui/basketgroup.pl
- acqui/neworderempty.pl
- acqui/uncertainprice.pl
- admin/aqplan.pl
- members/memberentry.pl
NOTE: neworderempty had 3 lines of it?! Didn't anyone see that?!

Here is the output of what I did to confirm this correction:

mtompset@debian:~/kohaclone$ git reset --hard origin/master
HEAD is now at 6e9086f Bug 3206: (QA followup) missing comma on sysprefs.sql
mtompset@debian:~/kohaclone$ git grep C4::Input
C4/Input.pm:package C4::Input; #assumes C4/Input
C4/Input.pm:C4::Input - Miscellaneous sanity checks
C4/Input.pm:  use C4::Input;
acqui/addorderiso2709.pl:use C4::Input;
acqui/basketgroup.pl:use C4::Input;
acqui/neworderempty.pl:use C4::Input;
acqui/neworderempty.pl:use C4::Input;
acqui/neworderempty.pl:use C4::Input;
acqui/uncertainprice.pl:use C4::Input;
admin/aqplan.pl:use C4::Input;
members/memberentry.pl:use C4::Input;
t/Input.t:        use_ok('C4::Input');
mtompset@debian:~/kohaclone$ grep sub C4/Input.pm
sub checkdigit ($;$) {
                my $temp2 = substr($infl,$i,1);
        if ($rem eq substr($infl,8,1)) {
} # sub checkdigit
mtompset@debian:~/kohaclone$ grep checkdigit `find acqui -type f`
mtompset@debian:~/kohaclone$ grep checkdigit `find admin -type f`
mtompset@debian:~/kohaclone$ grep checkdigit `find members -type f`
mtompset@debian:~/kohaclone$ cat t/Input.t

use strict;
use warnings;

use Test::More tests => 1;

BEGIN {
        use_ok('C4::Input');
}

Apply this patch, and the output of git grep C4::Input will be empty.
Run koha qa test tools (kind of overkill)

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: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-07-10 10:53:56 -03:00
Jonathan Druart
94315f663b Bug 9942: Make Koha fails if privacy is not respected
If a patron has requested anonymity on returning items and the system is
not correctly configured (AnonymousPatron no set or set to an inexistent
patron), the application should take it into account and not fail
quietly.

This patch is quite radical: the script will die loudly if the privacy
is not respected.

To be care of the bad "Software error", some checks are done in the
updatedatabase to be sure the admin will be warned is something is wrong
in the configuration.

Test plan:
1/ Test the updatedatabase entry:
a. Turn on OPACPrivacy and set AnonymousPatron to an existing patron
=> You will get a warning
b. Turn on OPACPrivacy and set AnonymousPatron to 0 or ''
=> You will get a warning
c. Turn on OPACPrivacy and set the privacy to 2 (Never) for at least 1 patron
Turn off OPACPrivacy
=> You will get a warning
d. In all other cases you will get no error

2/ Test the interface
a. Turn on OPACPrivacy and set the privacy to 2 (Never) for a patron
b. Now you can turn off OPACPrivacy or keep it on, behavior should be
the same
c. check an item out the patron
d. Check the item in using the check out table
=> fail
e. Check the item in using the Check in tab
=> fail (not gracefully).

Note that the software error could appear on other pages too.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Updatedatabase works as described
On staff, if don't have correct settings for anonymity it's
impossible to check-in (with OPACPrivacy on)
No errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-07-07 14:52:32 -03:00
186b635a75 Bug 13014: (QA followup) have new warnings tested
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-24 14:54:36 -03:00
Jonathan Druart
734a6805c8 Bug 13014: Notify budget owner on new suggestion - UT
When a suggestion is created and linked to a fund, a mail will be
generated, using a cronjob, to notify the budget owner.

A suggestion is considered as "can be treated" if its status is "ASKED".

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-24 11:39:40 -03:00
Jonathan Druart
cbf3c9aa40 Bug 14439: Add test - template path should finish by .tt
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-24 10:53:25 -03:00
Jonathan Druart
64e47c63dc Bug 14408: Allow integers in template paths
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-22 17:44:58 -03:00
Jonathan Druart
5dd7c8f0d5 Bug 14408: Add tests to get_template_and_user
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-22 17:44:58 -03:00
Stefan Weil
0cac7bc140 Bug 14383: Fix some typos in comments and documentation
Most of them were found and fixed using codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

http://bugs.koha-community.org/show_bug.cgi?id=14383
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-22 17:34:46 -03:00
Jonathan Druart
a712f5b7ba Bug 13993: Clarify test messages
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-06-19 11:45:23 -03:00
Mark Tompsett
b335b72991 Bug 13993: (1) Add tests to confirm 'new' and 'cancelled'
This adds 2 tests to t/db_dependent/Acquisition/TransferOrder.t
in order to confirm the order's status is properly marked.

TEST PLAN
---------
1) Log into staff client
2) Acquisitions
3) Create a basket for two differing vendors.
4) Place an order in one of the baskets.
5) Transfer the order from one vendor's basket to the others.
6) Apply this patch (1) only
7) prove -v t/db_dependent/Acquisition/TransferOrder.t
   -- should fail one test: not marked as 'cancelled'.

Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-06-19 11:44:45 -03:00
Benjamin Rokseth
57608fdecb Bug 7981: Remove HomeOrHoldingBranchReturn syspref
This patch removes HomeOrHoldingBranchReturn syspref and makes circ/returns.pl respect branch
circulation rules from C4::Circulation::GetBranchItemRule. Also transfer slip notice should reflect this.

Default should always be to return item to home branch.

Test plan:
- make sure syspref 'AutomaticItemReturn' is set to 'false'
- unset 'Default checkout, hold and return policy' or set 'Return policy' to 'Item returns home'
- checkout an item and do a checkin from different branch than items homebranch
- verify that you're prompted with a transfer message to item's home branch and that print slip matches

- set 'Return policy' to 'Item returns to issuing library'
- do a checkout and a checkin from branch different than item's home branch
- verify that you're not prompted with a transfer message and that holding library is your current branch

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

Follow-up:
- Added 3 tests in t/db_dependent/Circulation_Branches.t to test AddReturn
  policies
- Removed HomeOrHoldingBranchReturn from sysprefs.sql
- Added notice on removing syspref in updatedatabase

QA edits:
- removed trailing whitespace in tests
- moved branchname lookup from returns.pl to template

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-06-11 10:24:22 -03:00
Indranil Das Gupta
c07f83f643 Bug 14206: Adds test for getletter() call from overdue_notices.pl
Adds missing test for getletter() when called from overdue_notices.pl

Test plan
=========

1/ apply this patch
2/ run prove -v t/db_dependent/Letters.t
   all tests should pass, especially test #40 which tests call from
   overdue_notices.pl

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

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-11 10:14:35 -03:00
Indranil Das Gupta
8895caa339 Bug 14206: Adds delete function for non email templates
C4::Letters::getletter() is called in tools/letter.pl by the function
delete_confirm() to display the selected notice for deletion. Due to
current implementation of getletter(), a notice that does not use
the 'email' template (but uses any/all of the other templates - sms,
print or phone) can't be deleted from the staff client.

This patch adds deletion capability for notices that do not use email
template, but uses any/all of the other templates i.e. sms, print or
phone. This also adds 2 tests to t/db_dependent/Letters.t for testing
both conditions - a) when message_transport_type is specified b) when
it is not.

Test plan
=========

1/ Go to Tools -> Notices & Slips. Add a new notice only for print,
   leave 'Library' and 'Koha module' options as default selections.
   Enter 'KOHA_14206' and 'Koha Test 14206' against Code and Name
   respectively, and 'Test' and 'Test Message' for subject and body.
   Leave the Email, Phone and SMS tabs blank. Save the notice.
2/ On the notices listing page the new notice will be listed. Try to
   delete it. It will load the 'Delete notice' dialog form, but the
   table will not show any data under <th>s - 'Library', 'Module',
   'Code' or 'Name'.
3/ Click the "Yes, delete" button. The page will be submitted and the
   Notices listing reloaded. The print-only KOHA_14206 notice should
   continue to exist. This is *wrong*.
4/ Apply this patch
5/ Reload the listings page and click on the 'Delete' link for Notice
   KOHA_14206. This time, it should show the data under 'Module',
   'Code' or 'Name' at least.
6/ Click on 'Yes, delete'. The page should submit and the listing page
   reload. This time KOHA_14206 will be gone.
7/ Run prove -v t/db_dependent/Letters.t
   All tests should PASS without any error.

Followed test plan. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-11 10:14:22 -03:00
efe5266625 Bug 13437: Preliminary changes for marc21 plugins field 008
Preliminary work on marc21_field_008.pl and 008_authorities.pl.
Moving $dateentered en $defaultval to lower scope level.
date_entered is a new sub (in a module); sub Field008 has been reduced to
one line.
Added a trivial unit test for date_entered.
Note: the format used in date_entered could be added in DateUtils, moving
this logic to a better place.

Test plan:
Use both plugins in the marc21 editor (biblios/authorities).
Run the adjusted unit test.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Both plugins works, no errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-10 12:51:26 -03:00
Jonathan Druart
c5bc51d7d1 Bug 14256: (follow-up) Check for unique constraint to regenerate random data
There were some issues in the previous patch. This patch fixes the
following:
- rename $value with $original_value
- remove $at_least_one_constraint_failed and $values_ok which make the
  code unnecessarily complicated
- the constraints have to be checked only if no original value is passed
- _buildColumnValue created a key to the default value hashref, it broke
  the test:
    last BUILD_VALUE if exists( $default_value->{$source} );

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-10 12:47:07 -03:00
395304d3b5 Bug 14256: Check for unique constraint to regenerate random data
Unique constraints should be checked when creating random data. Otherwise
we get failures when the generated data already exists on the DB.

This patch takes advantage of ->unique_constraints() to do the job,
looping through all the unique constraints defined for the source.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-10 12:47:06 -03:00
717fa8440d Bug 14334: t/db_dependent/Letters.t AutoCommit fix
TEST PLAN
----------
1) git reset --hard origin/master
2) prove t/db_dependent/Letters.t
   -- horrible failure about transaction
3) apply this patch
4) prove t/db_dependent/Letters.t
   -- no issues
5) koha qa test tools.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-07 18:51:22 -03:00
Mark Tompsett
af6bb0b4db Bug 14334: t/db_dependent/Budgets.t AutoCommit fix
TEST PLAN
----------
1) git reset --hard origin/master
2) prove t/db_dependent/Budgets.t
   -- horrible failure about transaction
3) apply this patch
4) prove t/db_dependent/Budgets.t
   -- no issues
5) koha qa test tools.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-07 18:51:22 -03:00
Mark Tompsett
7f4a7f2eb3 Bug 14334: t/db_dependent/Bookseller.t AutoCommit fix
TEST PLAN
----------
1) git reset --hard origin/master
2) prove t/db_dependent/Bookseller.t
   -- horrible failure about transaction
3) apply this patch
4) prove t/db_dependent/Bookseller.t
   -- no issues
5) koha qa test tools.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-07 18:51:21 -03:00
5f5903737e Bug 14342: Unit tests in t/db_dependent/Context.t failing due to Bug 13967
The introduction of system preference objects in bug 13967 has caused
the current testing regimen to fail do to the mixing of DBI mocking and
DBIx::Class.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-07 18:38:45 -03:00
46419b797b Bug 14346: t/Biblio.t fails because of new warning
Running

 $ prove t/Biblio.t

fails because of us now using DBIx to retrieve sysprefs. Then our mocked DBI is not "supported" by DBIx hence a warning that makes our test fail (there is one more warning now).

The cool thing about this, is that it actually helped spot a situation where GetMarcBiblio is doing wrong things because is not checking its parameters are undefined, so we have the chance to fix it.

This patch makes GetMarcBiblio return undef if no biblionumber is passed, and
also raises a conveniently carped warning. This change is tested in t/Biblio.t with new tests.

To test:
- In current master, run
  $ prove t/Biblio.t
=> FAIL: a test detects a wrong warning count and fails.
- Apply the patch and run
  $ prove t/Biblio.t
=> SUCCESS: Tests now pass, and there are 2 new ones.
- Sign off :-D

Regards

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-07 18:37:32 -03:00
2e11350fe3 Bug 13967: (QA followup) Make DBIx control transactions on tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-04 15:12:45 -03:00
Jonathan Druart
2fa99fc7a0 Bug 13967: Add a couple of tests for SysPref and Object
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
2015-06-04 10:39:16 -03:00
6882949b1b Bug 13967 - System preferences need a package
System preferences should have a package based on Koha::Object to remove
the need for direct manipulation via SQL.

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

Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-04 10:39:11 -03:00
Mark Tompsett
8e726e3ee1 Bug 14111 - More t/Auth_with_shibboleth.t silencing
TEST PLAN
---------
1) Apply first patch
2) prove t/Auth_with_shibboleth.t
   -- failed?!
3) apply this patch
4) prove t/Auth_with_shibboleth.t
   -- success. *whew*
5) koha-qa test tools.

Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>

Test remarks: Expected outcome as per test plan. No anomaly noted.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-04 10:12:03 -03:00
Mark Tompsett
85a057bc5e Bug 14111: Silence warnings in t/Auth_with_shibboleth.t
Poorly capturing warnings_exist test cases generated noise.
This patch fixes that.

TEST PLAN
---------
1) $ prove t/Auth_with_shibboleth.t
   -- There are messages about lines 132 and 133. Noise.
2) Apply patch
3) $ prove t/Auth_with_shibboleth.t
   -- No messages. YAY!
4) koha qa test tools

Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>

Test remarks: Expected outcome as per test plan. No anomaly noted.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-04 10:12:03 -03:00
Mark Tompsett
1651cf70d1 Bug 5010: Fix OPACBaseURL to include protocol
First, it is strongly recommended to set the OPACBaseURL. But
this patch allows the inclusion of the protocol and not just
a site.

Next, C4/Auth now puts OPACBaseURL into the template parameters
regardless of OPAC or Staff clients.  t/db_dependent/Auth.t was
tweaked to add a check for confirming that get_template_and_user
adds OPACBaseURL to both OPAC and Staff templates.

In the staff client, once the OPACBaseURL is set, you get a nice
OPAC View link when viewing a biblio's detail. It should reflect
the protocol used now.

Hard coded 'http://' strings were removed from the
sample_notices.sql files. This is what required also updating
the letters table in the updatedatabase.pl script.

The explanation text in the sysprefs.sql needed updating too to
reflect the inclusion of the protocol. And this was the other
update done in the updatedatabase.pl script. The opac.pref file
was similarly changed as well.

catalogue/detail.pl had no need to pass a custom OpacUrl value,
since C4/Auth passes the required OPACBaseURL, so it and the
corresponding template were modified.

Both the MARC21 and NORMARC intranet details files had 'http://'
hard coded in them. This was removed.

Both the bootstrap and prog theme opac-detail template had a
protocol parameter that was used. The logic for the parameter
was not removed, because it is used extensively in one template.
Perhaps it should be used to simplify the other. However, the
calculated current_url parameter had references to the protocol
removed, because of the changes to OPACBaseURL.

opac/opac-shareshelf.pl had a hard coded 'http://' which was
removed.

t/db_dependent/Auth_with_cas.t had 'http://' added to the value
set for OPACBaseURL.

In virtualshelves/sendshelf.pl explicit code which sent the
OPACBaseURL preference was removed, since C4/Auth sends it all
the time now.

C4::Context::set_preference was tweaked to ensure that
OPACBaseURL would always start with http.
t/db_dependent/Context.t was tweaked to specifically test this.

The Shibboleth authentication needs OPACBaseURL set, and that
it be https protocol. The _get_uri routine was tweaked to always
pass back https:// as the protocol on the OPACBaseURL.
t/Auth_with_shibboleth.t was tweaked to specifically test the
changes.

TEST PLAN
---------
This is not an easy patch to test. Difficulties include:
- configuring Koha to run under https
    (tweaking apache2 isn't so hard, just tricky)
- configuring Koha to run OPAC and Staff with Plak
    (since code with comments about plak were sliced out)
- configuring Koha to use CAS
    (may be requires for the CAS test)

 1) Apply patch
 2) Make sure OPACBaseURL is set without the protocol included.

UPDATEDATABASE
 3) back up your DB
 4) ./installer/data/mysql/updatedatabase.pl
    -- It should run without errors.
 5) Look up the OPACBaseURL system preference in the staff
    client
    -- It should have http:// prepended.
 6) Run the mysqlclient from your koha git directory
      USE koha_library;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
    -- There should be no prepended http:// on the
       <<OPACBaseURL>>.
 7) restore your DB
 8) Make sure OPACBaseURL is set with the protocol included,
    preferably https.
    -- Using https requires a bunch of apache2 tweaks.

AUTH
 9) Call up staff client.
10) Call up OPAC.
    -- C4/Auth.pm doesn't barf.
11) Call up Plack staff client
12) Call up Plack OPAC.
    -- C4/Auth.pm doesn't barf.
13) prove -v t/db_dependent/Auth.t

CONTEXT
14) Home -> Koha administration -> Global System Preferences
         -> OPAC
15) Modify and save OPACBaseURL to not have http:// or https://
    on it.
    -- It should be modified to include http://
16) Modify and save another system preference.
    -- It should save normally
17) prove -v t/db_dependent/Context.t

CATALOGUE/DETAIL (tt & pl)
18) Confirm the OPACBaseURL is set
19) Navigate to any biblio details in the staff client
    -- There should be a "OPAC view" link which has the
       correct http:// or https:// in it.

SQL (sample notices and sysprefs)
20) Run the mysqlclient from your koha git directory
      USE koha_library;
      DELETE FROM letter;
      source installer/data/mysql/de-DE/mandatory/sample_notices.sql;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
      DELETE FROM letter;
      source installer/data/mysql/en/mandatory/sample_notices.sql;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
      DELETE FROM letter;
      source installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
      DELETE FROM letter;
      source installer/data/mysql/es-ES/mandatory/sample_notices.sql;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
      DELETE FROM letter;
      source installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
      DELETE FROM letter;
      source installer/data/mysql/it-IT/necessari/notices.sql;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
      DELETE FROM letter;
      source installer/data/mysql/pl-PL/mandatory/sample_notices.sql;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
      DELETE FROM letter;
      source installer/data/mysql/ru-RU/mandatory/sample_notices.sql;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
      DELETE FROM letter;
      source installer/data/mysql/uk-UA/mandatory/sample_notices.sql;
      SELECT content FROM letter WHERE content LIKE "%<<OPACBaseURL>>%";
    -- Each of the selects should should lines that have
       <<OPACBaseURL>> starting them, but no hard-coded http://
      DELETE FROM systempreferences;
      source installer/data/mysql/sysprefs.sql;
      SELECT * FROM systempreferences WHERE variable='OPACBaseURL';
    -- The explanation should reflect the new explanation.
      QUIT
21) restore your DB
22) Make sure OPACBaseURL is set with the protocol included,
    preferably https.
    -- Using https requires a bunch of apache2 tweaks.

SLIM2INTRANETDETAIL
23) Set 'XSLTDetailsDisplay' system preference to default.
24) Set 'marcflavour' system preference to MARC21.
25) View any biblio's details.
    -- the URL beside 'OPAC View' should have the appropriate
       http:// or https://
26) Set 'marcflavour' system preference to NORMARC.
27) View any biblio's details.
    -- the URL beside 'OPAC View' should have the appropriate
       http:// or https://

OPAC-DETAIL
28) Set 'opacthemes' to bootstrap.
29) Set 'SocialNetworks' to enabled.
30) In OPAC, view any biblio's details.
    -- the Share links should have the appropriate protocol on
       the OPACBaseURL.
31) Set 'opacthemes' to prog.
32) In OPAC, view any biblio's details.
    -- the Share links should have the appropriate protocol on
       the OPACBaseURL.

AUTH_WITH_CAS
33) prove -v t/db_dependent/Auth_with_cas.t

OPAC-SHARESHELF
34) Set 'OpacAllowSharingPrivateLists' to allow.
35) In OPAC, 'Save to Lists' a search result.
36) Save it to a new private list.
37) Click the Lists button, and select the new list.
38) Click the Share button.

AUTH_WITH_SHIBBOLETH
39) prove -v t/Auth_with_shibboleth.t
    -- needs to be tests on Debian, because I can't get
       the Test::DBIx::Class installed in Ubuntu. :(

Rebased again on kohadevbox...

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-04 10:00:04 -03:00
Mark Tompsett
8f12796633 Bug 14325: Test calls C4::Context::set_userenv
This is a case of works by accident. This patch corrects the
set_userenv call.

TEST PLAN
---------
1) prove t/db_dependent/Borrower_Discharge.t
   -- works
2) git grep :set_userenv
   -- only this one file.
3) Confirm the the C4/Context.pm has a set_userenv
   which shifts the first parameter, as intended for
   a -> call and not a :: call.
4) apply patch
5) prove t/db_dependent/Borrower_Discharge.t
   -- still works
6) git grep :set_userenv
   -- nothing now.
7) run koha qa test tools

Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-04 09:59:11 -03:00
Mark Tompsett
9c37d43102 Bug 14113: Silence t/Dates.t warnings and cleanup output.
The expectation of a user not freaking out over 'Illegal date'
messages is not sensible. Catch the messages, give a nicer
message.

Also, compress the veritical spacing on the output.

TEST PLAN
---------
1) $ prove t/Dates.t
   -- notice Illegal date messages, and extra lines between
      some sectional messages.
2) Apply patch
3) $ prove t/Dates.t
   -- Notice how nice and clean it is?
      Try it with -v to see all the output, including the
      expected warning type messages.
4) run koha qa test tools.

Test Remarks : complies with test plan.
Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>a

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-01 14:13:54 -03:00
Mark Tompsett
9878663731 Bug 14116: Silence noisy output for t/Scrubber.
Why diag or print out things, unless it is -v?
And why print anything except success or failure type messages?
This cleans up the output.

TEST PLAN
---------
1) $ prove t/Scrubber.t
   -- there's some noise.
2) apply patch
3) $ prove t/Scrubber.t
   -- noise issue resolved.
      Output is still reasonable for -v.
4) koha qa test tools

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-01 14:10:56 -03:00
Mark Tompsett
a4b7df4490 Bug 14117: Silence warnings t/SearchPazPar2.t
The use of relative URLS (null actually), triggers warnings.
Catch them, instead of letting them loose.

TEST PLAN
---------
1) $ prove t/Search_PazPar2.t
   -- noise for each test currently.
2) apply patch
3) $ prove t/Search_PazPar2.t
   -- No noise, and extra tests added.
      -v shows caught warning tests.
4) koha qa test tools.

Signed-off-by: Indranil Das Gupta <indradg@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-01 14:10:14 -03:00
Mark Tompsett
4d4582566e Bug 14112: Silence warnings in t/Charset.t
After Jonathan said this was the wrong way to correct the issue,
www.utf8-chartable.de made it clear to me that the \c3\a9 were
missing x's.

TEST PLAN
---------
1) prove t/Charset.t
   -- noise
2) apply patch
3) prove t/Charset.t
   -- no noise
4) koha qa test tools

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-27 14:32:41 -03:00
Julian FIOL
9381c95dc3 Bug 14059: Deleting 'issues' table before processing the tests
It's suppose to avoid foreign key trouble

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No error

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-05-22 17:02:22 -03:00
Julian FIOL
9c80f1fd77 Bug 14059: Delete all export of get_column_names
This deals with my concerns raised in comment #2.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
2015-05-22 17:02:21 -03:00
Julian FIOL
5c7b3aa8d1 Bug 14059: Testing C4::Creators::Lib
Testing C4::Creators::Lib at 100%
Deleting get_column_names subroutine (never used)

    TEST PLAN
    ---------
    1. Apply patch
    2. prove -v t/db_dependent/Creators/Lib.t
    -- All 644 tests should run successfully without
    any error or warning

    TEST PLAN OPTIONAL
    ------------------

    Check with bug 13899 to see the coverage of this module.

    Coverage BEFORE this patch :
    Statement  :  11,6%
    Branch     :   0,0%
    Condition  :    N/A
    Subroutine :  36,0%

    Coverage AFTER this patch :
    Statement  : 100,0%
    Branch     : 100,0%
    Condition  :    N/A
    Subroutine : 100,0%

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
2015-05-22 17:02:21 -03:00
Mark Tompsett
5d8aa7b70b Bug 14114: Silence warns and cleanup t/Debug.t
TEST PLAN
---------
1) $ prove t/Debug.t
   -- What's with this BEFORE and AFTER stuff?!
2) apply patch
3) $ prove t/Debug.t
   -- cleaner, and you only get fuller output with -v.
4) koha qa test tools

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Cleaner, no koha-qa errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-22 09:33:34 -03:00
Bernardo Gonzalez Kriegel
de448c0a1e Bug 14195: (followup) increment number of tests
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-20 11:05:27 -03:00
Jonathan Druart
ea41ef4ec9 Bug 14195: TestBuilder - A random string should not be longer than the DB field
t::lib::TestBuilder::_gen_text does not use correctly the regex and the
max parameter to generate the random string (String::Random).

This can cause future tests to fail.

http://bugs.koha-community.org/show_bug.cgi?id=14195
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Script tested, problem occurs, patch fixes it.
Bad number on commit subject
No errors

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-20 11:05:27 -03:00
fd581bea38 Bug 5338: (QA followup) update the tests for the new reports
This patch fixes the unit tests related to guided reports.
It is needed now that there are more options available.

It also fixes a wrong 'savedsql' key (should be 'sql') that
caused the tests to print warnings.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-19 13:54:09 -03:00
Julian Maurice
1970b245f5 Bug 13687: Move hold policy check into CanItemBeReserved
This way ILS-DI HoldItem and HoldTitle services also benefit from this
check

Test plan:

1/ Define some default holds policies by item type in
/admin/smart-rules.pl
2/ Use ILS-DI HoldItem service and check that those rules are respected
3/ Check that staff and opac hold behaviour is unchanged regarding
these rules.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script. No regressions found,
improves the ILS-DI HoldItem response.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-19 12:05:50 -03:00
Jonathan Druart
e546999f48 Bug 7380: Add tests for TT plugins
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-19 10:10:31 -03:00
422ffc6406 Bug 14200: Regression tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Karen Bryant <kbryant@ccpl-fl.net>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-19 09:45:04 -03:00
df8b81678b Bug 13673: (QA followup) Add license
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-15 16:00:28 -03:00
Mark Tompsett
49c384b242 Bug 13673: Silence noisy warnings in t/db_dependent/Barcodes.t
This last patch catches all the warning messages in tests.

TEST PLAN
---------
1) Apply first two patches
2) $ prove t/db_dependent/Barcodes.t
   -- still noisy warnings.
3) apply last patch
4) $ prove t/db_dependent/Barcodes.t
   -- All noisy warnings are caught.
5) koha qa test tools.

Signed-off-by: Indranil Das Gupta <indradg@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-15 16:00:28 -03:00