Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Remove a few last references to branchprinter, mostly from tests.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
As statistics does not have a PK we need to adjust the TestBuilder
tests.
Bug 18441 already exists for adding the PK.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
deletedborrowers does not have a PK, and adding it is out of the scope
of this patchset. Indeed we will have to handle possible duplication of
borrowernumber values, which does not seem trivial.
Having bug 20271 in mind, we will have to deal with this problematic
anyway later.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
To make sure this kind of random failures will not appear in a future we
are going to fix it at TestBuilder level.
Test plan:
prove t/db_dependent/TestBuilder.t
and confirm it returns green
You could also only apply the tests against master, run them several
times and confirm that they fail most of the time.
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>
This minimal class encapsulates the tabs to be passed around to the
templates, so error checking on missing bits is done in a single place.
It throws exceptions on errors
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
We should use build_sample item (from bug 21971) to create items,
otherwise we may not have a valid biblioitem and/or MARC record.
Test plan:
Set SearchEngine to ES
prove that the tests in Circulation.t now pass
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
The QA tools don't current recognise the WHILE directive used in this
template update. This patch adds the keyword to the list of recognised
directives and thus allows through unfiltered variables during QA runs.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
The find method in RefundLostItemFeeRules had been overloaded to only
support a hash being passed, however find can be called with a bare
array of primary key values (i.e. id in this case). TestBuilder relies
on this functionality and started to fail; This patch simply restores
the original behaviour for when a single value (or array of values) is
passed.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This patch introduces tests for new plugin hooks added to
C4::Biblio::{Add|Mod|Del}Biblio and C4::Items::{Add|Mod|Del}Item.
They are tested together as for creating an item you need to first create
a biblio and tests looks basically the same.
The testing strategy is
- Make sure the plugin is passed the right params
- Throw an exception at plugin-level, to be trapped by the C4::Biblio
and C4::Items lib, and converted into a warning. So we test for the
warning.
- Also, the fact that C4::Biblio and C4::Items warns, means the
exception was cought, and then Koha won't break on faulty plugins or
fatal errors from plugins.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This patch implements bug 15339 for build_object.
We want it to warn if the call is wrong.
Test plan:
Make sure the tests are still returning green
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
I have no idea why this only appears today but TestBuilder generates dates using DateTime->now,
which does not take into account the timezone.
It has been highlights by a failing test today on U18.
Why today whereas this patch was pushed few weeks ago?
Why U18 and not D9?
The output of the test is:
koha_1 | # Failed test 'With BorrowerLogs and TrackLastPatronActivity we should not spam the logs'
koha_1 | # at t/db_dependent/Koha/Patrons.t line 1421.
koha_1 | # got: '2'
koha_1 | # expected: '1'
koha_1 | # Looks like you failed 1 test of 4.
koha_1 |
koha_1 | # Failed test 'BorrowersLog tests'
koha_1 | # at t/db_dependent/Koha/Patrons.t line 1422.
koha_1 | # Looks like you failed 1 test of 33.
koha_1 | [19:51:44] t/db_dependent/Koha/Patrons.t
Actually there are 2 logs, one for the cardnumber that is expected, and on for updated_on:
"updated_on" : {
"after" : "2019-03-04 21:10:00",
"before" : "2019-03-04 18:10:00"
}
Apart from the fact that we may want to remove this updated_on field from MODIFY,
the before/after dates differ from 3 hours.
Here it's currently 18:10 and in UTC-3
To prevent such behaviors in tests (create stuffs in the future...), we should
use our Koha::DateUtils::dt_from_string method that takes care of the timezone
used in other places of Koha.
Test plan:
prove t/db_dependent/Koha/Patrons.t
May fail without this patch.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
This patch is fine in itself, but there may still be an issue around
the failing test for TrackLastPatronActivity. Reopened bug 22741.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Test plan:
1) Play with fines, should work OK
2) Try to print receipts on fines - prinfeercpt.pl, printinvoice.pl
3) git grep getnextacctno -> no occurences
4) git grep accountno should return only:
installer/data/mysql/atomicupdate/bug_21683_remove_column_accountno.perl
installer/data/mysql/update22to30.pl
misc/release_notes/release_notes_3_10_0.txt
misc/release_notes/release_notes_3_22_0.txt
5) prove
t/db_dependent/Accounts.t
t/db_dependent/ILSDI_Services.t
t/db_dependent/Stats.t
t/db_dependent/Koha/Account.t
Rescued-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Those 2 filters should return safe output as well
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
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>
We certainly should not expect this filter to be used much for href, but
we have one occurrence that needs it.
Test plan:
t/template_filters.t and xt/find-missing-filters.t must return green
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>
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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Stephen Graham <s.graham4@herts.ac.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Stephen Graham <s.graham4@herts.ac.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
With strict SQL modes we now have TestBuilder tests that fail randomly with:
Out of range value for column 'tax_rate_on_receiving'
Out of range value for column 'discount'
We are trying to insert a value that is too high for the type defined at DB level.
It happens for discount when a value > 100 is generated. The datatype is float(6,4).
From the MySQL Doc:
"""
MySQL permits a nonstandard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D).
Here, (M,D) means than values can be stored with up to M digits in total, of which D digits may be after the decimal point.
"""
So float(6,4) does not allow 100.
To recreate easily the issue:
use t::lib::TestBuilder;
my $builder = t::lib::TestBuilder->new;
$builder->build( { source => 'Aqorder', value => { discount => 100 } } )->{discount};
To make sure this patch fixes the issue you can use this script:
use Modern::Perl;
use t::lib::TestBuilder;
my $builder = t::lib::TestBuilder->new;
my ( $real, $i ) = ( 0, 0 );
while ( $real < 100 ) {
$real = $builder->_gen_real( { info => { size => [ 6, 4 ] } } );
warn $i++;
}
warn "$i - $real";
Test plan:
0/ Does not apply this patch
1/ Run the snippet above
2/ Confirm that it fails quite quickly (constantly before 500 for me)
3/ Apply this patch
4/ Run again the script
5/ Confirm that it is stuck in an infinite loop
6/ CTRL-C :D
QA Note:
Other _gen_* subroutine may need a fix, but we will wait for them to fail
TODO:
1. Add JS check to the interface to prevent the use to enter a value > 100
2. Allow '100' as a valid value for discount (?)
Followed test plan, patch worked as described
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
See bug 21526 comments 5-7
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Only the first TT params in a href was taken into account.
This also takes care to replace into href attributes only (for instance not
title, etc.)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
The QA script call 'missing_filters', it sounds better to keep it in
order to avoid fixing it and have a weird condition (if
module->can('subroutine_name')) to maintain
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
See bug 13618 and bug 21526.
We need a script to add missing filters, or replace wrong ones.
Test plan:
- Add unescaped variables to .tt files
- prove xt/find-missing-filters.t
will warn about them
- perl misc/devel/add_missing_filters.pl
will add the missing/wrong filters
- prove xt/find-missing-filters.t
will now be happy
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
We should have plugin hooks for the staff interface just like we have for the OPAC as detailed on bug 20181.
Test Plan:
1) Apply this patch
2) Download and install the Kitchen Sink plugin ( v2.1.19 or later )
https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases/download/v2.1.19/koha-plugin-kitchen-sink-v2.1.19.kpz
3) Install the plugin
4) Restart all the things if you can ( restart_all if you are using kohadevbox )
This will ensure the plugin takes effect right away, it should be
necessary but it won't hurt anything!
5) Load the staff intranet, notice you get an console error log message and the background
for your staff intranet is now orange ( assuming you've not customized the
staff intranet in any way )
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Test plan:
- Apply first patch
- Confirm that tests is failing (t/template_filters.t)
- Apply second patch
- Confirm that tests return green
- Apply last patch
- Confirm that prices are displayed correctly
QA step:
Edit a template and add the following 2 lines:
[% SET p = '<script>alert("foo");</script>' %]
[% x | $Price %]
=> Display '0.00'
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
To make it reusable easily from QA test tools
https://gitlab.com/koha-community/qa-test-tools/issues/3
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
It would be nice if plugins had an upgrade method to handle altering tables and such when a new version of a plugin is installed. Right now it must be done in a completely bespoke manner.
Test Plan:
1) Apply this patch
2) Download the 2 most recent releases of the Kitchen Sink plugin
https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases
3) Install the earlier release
4) Look at the configuration page, at the bottom it should say the
plugin has never been upgraded
5) Install the newer release
6) Reload the configuration page, it should now say that the plugin
was upgraded and give you the date and time of the upgrade
Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This path implements unit tests for the route-from-plugin development.
It adds the required methods to the Koha::Plugin::Test plugin
distributed along with the tests. A second plugin implementing invalid
OpenAPI specs is added (Koha::Plugin::BadAPIRoute).
Edit: I made terminology changes to make it less rude.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
It is a real pain to debug selenium errors, especially when it is
not reproducible locally.
This patch capture a screenshot when an error occurred and upload it
using the excellent lut.im service provided by framasoft
(We could host our own later).
Test plan:
Modify a selenium script to make it fails (search for find_element)
You will see a stack trace followed by a link to framapic.org
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This patch reuses the method newly added to Selenium.pm and improve
existing tests.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>