This patch teaches C4::Reports::Guided::execute_query()
how to accept a list of query parameter values. It then
follows-up on the main patch by simplifying how it converts
report parameters to a complete SQL query, and removes the
use of DBI->quote() and complicated regexes.
To test:
[1] Verify that using the OPAC svc/report service with
sql_params continues to work.
[2] Verify that there are no regressions with running
reports from the staff interface, both via the web
service and the reports interface.
[3] Verify that prove -v /db_dependent/Reports_Guided.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
No regressions found.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The sharedate column is documented as having the following meaning:
"date of invitation or acceptance of invitation"
This patch adjust the new list-sharing code to stick with that
interpretation, as otherwise the column should have been renamed
to 'invite_expiration_date' or the like.
It also removes the "housekeeping" functionality from AddShare, as
otherwise the routine should have been named AddShareAndDoOtherStuff.
To prevent list shares from piling up, a new --list-invites flag
has been added to cleanup_database.pl. The default crontabs have
been modified to use the --list-invites flag by default.
To test
-------
[1] Make some list share invites and accept some, but now all of them.
[2] Wait 14 days (or more reasonably, manually edit the sharedate
values for the unaccepted shares to put them at least 14 days in the
past.).
[3] Run cleanup_database.pl --list-invites
[4] Verify that accepted shares remain, as to share invites that have
not yet reached more than 14 days of age.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch combines some work from bugs 10389 and 10441.
With thanks to Srdjan and Jonathan Druart for their contributions.
Adds tests for AddShare, AcceptShare, IsSharedList, RemoveShare.
This patch also restores the inadvertently deleted DelShelf tests
in bug 10499.
Test plan: Run the test VirtualShelves.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
t::lib::Mocks::mock_preference provides a simple way to mock syspref.
Test plan:
Verify that t/db_dependent/Biblio.t returns green.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The current implementation of GetMarcISBN contradicts the documented API.
It currently returns an array of hashes with only one key (marcisbn)
which doesn't add any value to it.
I chose to fix GetMarcISBN to honour the API instead of changing thex
docs, because it seems a really silly change.
To test:
- Run:
prove t/db_dependent/Biblio.t
=> SUCCESS
- catalogue/detail.pl should correctly show ISBNs.
- opac/opac-detail.pl should correctly show ISBNs in both prog and bootstrap.
- opac-opac-sendshelf.pl should correctly show ISBNs in the email.
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch makes the tests run in both MARC21 and UNIMARC contexts.
It previously run only for MARC21. It mocks what needs to be mocked.
To test, run
- prove t/db_dependent/Biblio.t
=> Notice the first ISBN has a space in front of it and those tests fails.
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch teaches the ordering receiving process how to
set vendor and internal order notes.
One observation: I'm not sure it's entirely useful to set
a note to communicate to the vendor during receiving --
how is it to be sent to them, and why?
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch fixes UT, to take into account the new fields
order_internalnote and order_vendornote.
Note that "notes" field is still returned as well by some
acquisition subs (those which return all the fields of biblio
and biblioitems table)
Test plan :
run prove t/db_dependant/Acquisition.t
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Test plan:
prove t/db_dependent/Acquisition.t
prove t/db_dependent/Acquisition/Invoices.t
prove t/db_dependent/Acquisition/OrderFromSubscription.t
all should return green.
NOTE: Any error messages are the same between master and this
patch, and are unrelated to the added/revised tests.
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Revised test plan:
1/ Create an order with 2 items
2/ Receive 1 item and enter a note for the order
3/ Verify the note is not saved
The note should be visible on the Mod Order Details screen,
but it isn't there.
4/ Apply patch
5/ Receive the second item and enter a note for the order
6/ Verify the note is correctly saved
The note is visible on the Mod Order Details screen.
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works as described. The note now saves correctly and also remains when
you undo a receipt.
Note: it would be nice to show the note on the receive page as well.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test for the condition noted
in bug 9578, where attempting a sort of a Zebra search that
fails because of an invalid query crashes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Show 'Unknown' when planneddate and publisheddate cannot be calculated
Also fixes SQL query in misc/cronjobs/serialsUpdate.pl that was still
using "periodicity != 32" to exclude irregular subscriptions from
results
Test plan:
1) Create a subscription in the serials module. Make sure to choose:
Frequency = Irregular
2) Test the prediction pattern, first publication date is set to
"First issue publication date" field, others will show as
'unknown'
3) Save the subscription
4) Check the created issue - it will show a published date and a
planned date (same as "First issue publication date" field)
5) Receive the issue and check the next generated issue, planned
date and published date should show as 'Unknown'
6) Generate a next issue, planned date and published date should
also show as 'Unknown'
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described following test plan.
No koha-qa errors
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Also tested:
- multi receiving generates mulitple issues without dates - 'unknown'
- staff detail page shows the dates empty, which is fine
- OPAC detail page shows the dates empty, which is fine
- serial collection page shows 'unknown' and those issues appear
on the 'manage' tab, as they did in the past
- Editing the issue from the serial collection page leaves the
date fields empty.
- Receving the issue, setting the status to 'Arrived' the Expected on
date is set to 'today' automatically. Date published has to be
entered manually (maybe something we could improve later
- subscription detail > issues tab shows Uknown.
- t/db_dependent/Serials/GetNextDate.t pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch fixes a problem whereby staff users could
edit subscriptions they are not permitted to by going directly
to the subscription details page.
It also adds some unit tests for the can_edit_subscription routine
and add a new can_show_subscription routines.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Notes on second patch.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test for verifying that superlibrarians
can see all subscription when IndependentBranches is on.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch fixes a problem where the holds queue generator
was making requests where the pickup library is the
same as the item's library but not the patron's branch,
even if there is a "Default holds policy by item type" rule that states
this item can only fill holds for patrons of the same library as the
item.
Test Plan:
1) Create a test record with 2 items with different itemtypes
2) Set the Default holds policy by item type for the first
item to "From any library"
3) Set the Default holds policy by item type for the second
item to "From home library"
4) Place a record level hold for a patron from another library,
but for pickup at the same library as the item is from
5) Rebuild the holds queue
6) View the holds queue, note the item is listed, though this
patron cannot place a hold on this item
7) Apply this patch
8) Repeat step 5, note the hold is no longer in the queue
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
automated tests pass, functional tests pass. Bug replicated, eradicated by patch.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I finally managed to reproduce this, patch works as described.
Passes tests and QA script, provided tests fail without patch, but
succeed with the patch.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch modifies _Findgroupreserve so that its one caller,
CheckReserves(), would include the reserve_id field in the
hold request it returns.
Failure to include reserve_id in every circumstance resulted
in bug 11947. This patch is therefore a complementary fix for
that bug, but is not meant to preempt the direct fix for
that bug.
To test:
[1] Verify that t/db_dependent/Reserves.t passes.
[2] Verify that the following test plan taken from
the patch for bug 11947 works for this patch
*without* applying the patch for 11947:
* have a few borrowers, say 4.
* have a biblio with a single item (you can scale this up, it should
work just the same.)
* issue the item to borrower A
* have borrowers B, C, and D place a hold on the item
* return the item, acknowledge that it'll be put aside for B.
* view the holds on the item.
Without the patch:
* the hold priorities in the UI end up being "waiting, 2, 1" when they
should be "waiting, 1, 2".
* in the database "reserves" table, they're really "0, 2, 3" when they
should be "0, 1, 2".
With the patch:
* the hold priorities in the UI end up being "waiting, 1, 2"
* in the database, they're "0, 1, 2"
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described. No koha-qa errors. Test pass
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds unit tests for C4::AuthoritiesMarc::BuildSummary
for both UNIMARC and MARC21 and a regression test for the "Odd
number of elements in anonymous hash" warning.
To test:
[1] Run prove -v t/db_dependent/AuthoritiesMarc.t. It should
report one failure.
[2] Apply the main patch.
[3] Run t/db_dependent/AuthoritiesMarc.t again; it should pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Currently when a reserve is moved to "waiting" status because it's
acknowledged on checkin, the reserve priorities aren't renumbered. This
causes things to go a bit haywire in the UI, in particular, some
reserves can unjustly end up with priority 1 when they shouldn't. It
also seemed to mess with the logic of who should get it next, but I
didn't look too closely at that.
This patch forces a renumbering so that all the priorities remain
copacetic.
Test plan:
* have a few borrowers, say 4.
* have a biblio with a single item (you can scale this up, it should
work just the same.)
* issue the item to borrower A
* have borrowers B, C, and D place a hold on the item
* return the item, acknowledge that it'll be put aside for B.
* view the holds on the item.
Without the patch:
* the hold priorities in the UI end up being "waiting, 2, 1" when they
should be "waiting, 1, 2".
* in the database "reserves" table, they're really "0, 2, 3" when they
should be "0, 1, 2".
With the patch:
* the hold priorities in the UI end up being "waiting, 1, 2"
* in the database, they're "0, 1, 2"
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Test plan confirms that the problem exists and that the patch corrects
it.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, especially t/db_dependent/Reserves.t.
Improves priority calculation.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a direct unit test of GetSoonestRenewDate()
and verifies that CanBookBeRenewed() returns a 'too_soon'
error as expected.
To test:
[1] Verify that prove -v t/db_dependent/Circulation.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch makes the new parameter norenewalbefore known to
unit test Circulation_Issuingrule.t.
To test:
1) Before applying the patch:
prove t/db_dependent/Circulation_Issuingrule.t
2) Notice that the test fails with:
$got->{norenewalbefore} = undef
$expected->{norenewalbefore} = Does not exist
3) Apply the patch.
4) Run test again and it should pass.
Sponsored-by: Hochschule für Gesundheit (hsg), Germany
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
This patch updates two of the tests cases to directly compare
the results returned by get_opac_new with the expected value
by using is_deeply(). Consequently, it removes the use of magic
numbers (which do not stop being magic numbers if they're wrapped
in constants named F1, F2, etc.).
To test:
[1] Verify that prove -v t/db_dependent/NewsChannels.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This adds the ability to specify whether staff, OPAC,
or slip news entries apply to all libraries or just a
particular library.
With the branch parameter added to key functions in
C4/NewsChannels.pm, function calls in C4/Members.pm,
mainpage.pl, opac/opac-main.pl, tools/koha-news.pl, and
t/db_dependent/NewsChannels.t were needed.
Some license texts were updated.
Templates were modified to display, allow for entry and editing
of the branches selected.
TEST PLAN
---------
1) Having logged into the staff client, is the news displaying
correctly? Have you entered a news item which should not
display for this branch of logged in user?
2) Find a patron (with some items checked out?)
3) Print a slip
- News which is labelled 'All Branches' or for the same branch
as the one printing the slip should display on the slip.
- THIS DOES NOT AFFECT QUICK SLIPS
4) Home -> Tools -> News
- Can you edit a news item?
- Does the change save correctly?
- Can you filter based on location and branch correctly?
- Can you add a new entry correctly?
- Can you delete an entry correctly?
5) Open an OPAC client.
- Does only the news for all branches display?
6) Log into the OPAC client.
- Does the news for all branches and the specific branch display?
7) prove -v t/db_dependent/NewsChannels.t
- Does it run and all succeed?
- Does the code seem to catch the required cases?
8) Comparing the patched and unpatched versions of files affected,
are the license changes missing anything?
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Changed the add and update functions to use a hash reference
for the parameter, so that adding or subtracting parameters
should be easier. Added some POD for the add_opac_news and
upd_opac_news functions, so that developers would know how to
call it.
The hashref changes resulted in being able to return 0 for
failure and 1 for success. This meant adding a couple tests
to the test file.
And while testing, there was some sort of logic problem with
the matter of '' being all, but selecting all only showed
things set for all, and excluded particular languages, or other
interfaces.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Testing was lacking, this tests every function call. As a
side effect, this moved the stub of a test file from
t/NewsChannels.t to t/db_dependent/NewsChannels.t, since the
table opac_news must exist.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Passes all 8 tests
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test for verifying that a
DBIx::Class schema object initialized by Koha database sets up
the database connection to correct store and retrieve UTF8
values as Perl utf8 strings.
To test:
[1] Apply this patch.
[2] Run prove -v t/db_dependent/Koha_Database.t
[3] The test should fail.
[4] Apply the main patch for this bug, then do step 2 again.
[5] The test should pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The new tests will not function if there isn't a valid
configuration (or mocking of preference()) so this patch
moves them to t/db_dependent/Context.t.
To test:
[1] After applying the main patch for this bug, verify that
prove -v t/db_dependent/Context.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
To test:
[1] Verify that prove -v t/db_dependent/Circulation_issuingrules.t
passes.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
replaces given-when with if-elsif-else constructs.
Tests still pass and code looks good.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
If GetOrder is called with a nonexistent ordernumber or without any
ordernumber, it should return undef.
Test plan:
prove t/db_dependent/Acquisition.t
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Updated number of tests to 68, tests and QA script all happy now.
Looked at a few pages in aquisition using GetOrder as well.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch finishes the work started in one of the previous
follow-ups and allows CardnumberLength to be set to a value
like ',5'. In conjunction with not including cardnumber in
BorrowerMandatoryField, this allows a cardnumber to not be
required but, if present, to not exceed the specified length.
This patch also updates t/db_dependent/Members.t so that
it runs in a transaction, tests the new return value
of checkcardnumber, and manages the CardnumberLength syspref.
To test:
[1] Verify that prove -v t/db_dependent/Members.t and
prove -v t/Members/cardnumber.t pass.
[2] Set CardnumberLength to ",5" and take cardnubmer out of
the BorrowerMandatoryField list.
[3] Verify that you can save a patron record without a cardnumber,
but if you supply one, that it can be at most 5 characters long.
[4] Add cardnumber back to BorrowerMandatoryField. This time, the
minimum length is 1 even though CardnumberLength is ",5".
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The SearchOrders routine should return the booksellerid and this
patch adds it.
This fixes several problems:
[1] The link to the vendor on the order receive page breadcrumbs
was broken.
[2] The tax calculation in finishreceive.pl didn't run.
[3] The item booksellerid field never got updated during
receipt.
Booksellerid was returned before bug 10723.
Quick test plan:
Go on orderreceive.pl and verify that the vendor link is correct.
Followed test plan. Vendor link is now correct.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch also adds POD and UT for the change in SearchOrders()
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
DBD::Mysql provides a mysql_auto_reconnect flag. Using it avoids
the time required to do a $dbh->ping().
Benchmarks:
use Modern::Perl;
use C4::Context;
for ( 1 .. 1000 ) {
$dbh = C4::Context->dbh;
}
* without this patch on a local DB:
perl t.pl 0,49s user 0,02s system 98% cpu 0,525 total
* without this patch on a remote DB:
perl t.pl 0,52s user 0,05s system 1% cpu 37,358 total
* with this patch on a local DB:
perl t.pl 0,46s user 0,04s system 99% cpu 0,509 total
* with this patch on a remote DB:
perl t.pl 0,49s user 0,02s system 56% cpu 0,892 total
Testing the auto reconnect:
use Modern::Perl;
use C4::Context;
my $ping = $dbh->ping;
say $ping;
$dbh->disconnect;
$ping = $dbh->ping;
say $ping;
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Real improvement. No koha-qa errors
prove t/db_dependent/Circulation_issuingrules.t produces no error
prove t/db_dependent/Context.t produces no error
Test
1) dumped Koha DB, load it on a non-local server
2) run sample script whit and without patch, local and remote
use Modern::Perl;
use C4::Context;
for ( 1 .. 100000 ) {
my $dbh = C4::Context->dbh;
}
Main difference I note is with remote server
a) without patch
real 0m16.357s
user 0m2.592s
sys 0m2.132s
b) with patch
real 0m0.259s
user 0m0.240s
sys 0m0.012s
I think this could be good for DBs placed on
remote servers
Bug 10611: add a "new" parameter to C4::Context->dbh
When dbh->disconnect is called and the mysql_auto_reconnect flag is set,
the dbh is not recreated: the old one is used.
Adding a new flag, we can now force the C4::Context->dbh method to
return a new dbh.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 10611: Followup: remove useless calls to dbh->disconnect
These 3 calls to disconnect are done at the end of the script, they are
useless.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script. Also checked
t/db_dependent/Holds.t
t/db_dependent/HoldsQueue.t
Tested holds triggering with different settings of
AllowHoldsOnDamagedItems. Works as described.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Changed title and author field for UNIMARC.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested for MARC21, NORMARC and UNIMARC by adding temporary set_preference..
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Set marcflavour to MARC21 to make tests pass.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Works for MARC21. But I would prefer a better fix for UNIMARC.
Will send a follow-up for that.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Adding a few unit tests, including the following situations:
Placing a hold when there is a wait.
Placing a hold when there is a future hold.
Calculating priority with future date.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Rebased on January 29, 2014 (marcelr)
Added text on the two 'is'-statements.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch removes the remainder of the old unit test
for bug 10723 and updates the label of the new test that
now checks that SearchOrders({ pending => 1}) omits received
orders.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4::Acquisition need more UT, and more robust ones. This patch
adds some.
This patch adds UT to
- GetOrder
- GetOrders
- GetCancelledOrders
- GetLateOrders
It refactors UT for SearchOrders
New UT use 2 new routines, used for check the list of fields returned
by a routine:
_check_fields_of_order
_check_fields_of_orders
These 2 routines could later be used by other UT
_check_fields_of_order has its own UT (tests n°14,15,16).
to test :
prove -v t/db_dependent/Acquisition.t
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Unit tests pass, passes koha-qa.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa and t
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds locking to rebuild_zebra.pl to ensure that simultaneous
changes are prevented (as one is likely to overwrite the other).
Incremental updates in daemon mode will skipped if the lock is busy
and they will be picked up on the next pass. Non-daemon mode
invocations will also exit immediately if they cannot get the lock
unless the new flag -wait-for-lock is specified, in which case they
will wait until the get the lock and then proceed.
Supporting changes made to Makefile.PL and templates for the new
locking directory (paralleling the other zebra lock directories).
We stash the zebra_lockdir in koha-conf.xml so rebuild_zebra.pl
can find it.
To address earlier QA concerns we:
1. added code to check if flock is available and ignore locking if
it's missing (from M. de Rooy)
2. changed default for adhoc invocations to abort if they cannot
obtain the lock. Added option -wait-for-lock if the user prefers
to wait until the lock is free, and then continue processing.
3. added missing entry to t/db_dependent/zebra_config.pl
4. added a fallback locking directory of /tmp
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Doug merged the original patch with the QA changes.
Just for the record, noting here that the original patch was tested
extensively too by Martin Renvoize.
I have added a followup for some exceptional cases.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch makes Koha <-> Zebra use MARCXML for the serialization when
using DOM, and USMARC for GRS-1.
* The following functions are modified to set the Zebra record syntax
according to the current sysprefs and configuration:
- C4::Context->Zconn
- C4::Context-_new_Zconn
* A new function 'new_record_from_zebra' is introduced, which checks the
context we are in, and creates the MARC::Record object using the right
constructor.
The following packages get touched to make use of the new function:
- C4::Search
- C4::AuthoritiesMarc
and the same happens to the UI scripts that make use of them (both in
the OPAC and STAFF interfaces).
* Calls to the unsafe ZOOM::Record->render()[1] method are removed.
Due to this last change the code for building facets was rewritten. And
for performance on the facets creation I pushed higher version
dependencies for MARC::File::XML and MARC::Record (we rely on
MARC::Field->as_string).
* Calls to MARC::Record->new_from_xml and MARC::Record->new_from_usmarc
are wrapped with eval for catching problems [2].
* As of bug 3087, UNIMARC uses the 'unimarc' record syntax. this case is
correctly handled.
* As of bug 7818 misc/migration_tools/rebuild_zebra.pl behaves like:
- bib_index_mode (defaults to 'grs1' if not specified)
- auth_index_mode (defaults to 'dom')
here we do exactly the same.
To test:
- prove t/db_dependent/Search.t should pass.
- Searching should remain functional.
- Indexing and searching for a big record should work (that's what the
unit tests do).
- Test an index scan search (on the staff interface):
Search > More options > Check "Scan indexes".
- Enable 'itemBarcodeFallbackSearch' and try to circulate any word, it
shouldn't break.
- Searching for a biblio in a new subscription shouldn't break.
- Running bulkmarcimport.pl shouldn't break.
- And so on... for the rest of the .pl files.
[1] http://search.cpan.org/~mirk/Net-Z3950-ZOOM/lib/ZOOM.pod#render()
[2] a record that cannot be parsed by MARC::Record is simply skipped (bug 10684)
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This makes it easier to read. Also fixes the test count, and is rebased
against 11499 which is needed to correctly test the patches for this bug
(i.e. indexing mode needs to be correctly set in koha-conf.xml)
To test:
[1] Run prove -v t/db_dependent/Search.t
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This adds direct tests of indexing and retrieving
bib records that are larger than the ISO2709 limit
of 99,999 octets.
To test: verify that prove -v t/db_dependent/Search.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test for ensuring that the
authorisedby field is returned by SearchOrders().
To test:
[1] Upon applying the main patch, verify that
prove -v t/db_dependent/Acquisition.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adjusts the new GetLoggedInBranchcode() template function so
that it returns the empty string rather than undef if there is no
active user environment. That way, there won't be lots of undefined
value warnings if/when this function gets used in the OPAC.
This patch also adds test cases.
To test:
[1] Verify that there are no regressions in the main test
plan for this bug.
[2] Verify that prove -v t/db_dependent/Koha_template_plugin_Branches.t
passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The return from GetReservesFromBiblionumber contains an unnecessary
extra variable. In scalar context an array returns its element count.
Maintaining a separate count can lead to unforeseen bugs
and imposes ugly constructions on the subroutine's users.
Remove the useless count variable from the return
This patch also changes the parameters: now the routine takes a hashref.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Placed biblio holds, future holds and item holds. Works as expected.
Tested Holds.t and Reserves.t. Pass.
Tested /cgi-bin/koha/ilsdi.pl?service=GetRecords&id=999 with two holds on
one item. Fine.
C4/SIP/ILS/Item.pm: Looked for "whatever" and "arrayref" and could not find
them anymore. Looks good.
Handled a few unneeded calls in QA follow-up.
Left only one point to-do for serials/routing-preview.pl. See Bugzilla.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The set of related ISBNs for the first Harry Potter book returned
by OCLC's XISBN service has changed recently, so this patch adjusts
the test to match.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch fixes an issue where chosing 'None' as the sort order
for an authority search would result in zero hits if QueryParser is
eanbled.
This patch also adds some additional test cases.
To test:
[1] Enable QueryParser.
[2] Perform an authority search in the staff interface that
uses 'Heading A-Z' as the sort order and returns hits.
[3] Run the same search, but with the sort order set to 'None'.
No hits are returned.
[4] Apply the patch.
[5] Do step 3 again. This time, hits should be returned.
[6] Verify that prove -v t/db_dependent/Search.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch duplicates the SearchAuthority tests, with QP enabled.
Searching shouldn't be affected by QP. Instructions for manually
reproducing this can be read in the first comment for the bug entry.
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
test plan:
prove t/db_dependent/Acquisition/TransferOrder.t should fail before the
patch and success after applying it.
Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Adds three tests to Reserves.t for GetReservesFromItemnumber.
We test if this routine does not return a future next available hold,
a future item level hold. And if it does return a future wait (that is:
a confirmed future hold, using ConfirmFutureHolds).
Note that Holds.t does also contains some basic tests for this routine,
but the additional tests seem to better located in the direct context of
tests for bug 9761 for ConfirmFutureHolds.
Test plan:
Run both t/db_dependent/Holds.t and t/db_dependent/Reserves.t.
Verify if both tests do not fail.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
To test:
1. Run prove t/Category.t
2. Apply patch
3. Run prove t/db_dependent/Category.t - Notice 2 tests were run
Signed-off-by: daniel <daniel.barker.nz@gmail.com>
Made the requested changes.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This test requires a valid Koha context, so this patch
moves it to t/db_dependent.
To test:
[1] Verify that prove -v t/db_dependent/Installer.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch moves t/Languages.t to t/db_dependent/Languages.t,
as the new get for getAllLanguages() works best if there's
a database available.
To test:
[1] Run prove -v t/db_dependent/Languages.t
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
- Remove unit tests for ParseSearchHistoryCookie, which doesn't exist
anymore
- Add unit tests for ParseSearchHistorySession and
SetSearchHistorySession
- Remove/Modify comments about search history cookie
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Tests fixed and moved, and comments tidied up
Signed-off-by: Charlene Criton <charlene.criton@univ-lyon2.fr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
By adding the relevant environment variables to the script the generated
koha-conf.xml file for the unit tests is correct now.
Test plan:
- Verify that tests pass now:
$ prove -v t/db_dependent/Search.t 2> /dev/null | grep 11499
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes unit test, koha-qa.pl
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
t/db_dependent/Search.t creates its own temporary koha-conf.xml and
related files, and it fails to properly set indexing modes for
bibliographic and authority records.
This patch adds regression tests for that.
To test:
$ prove -v t/db_dependent/Search.t 2> /dev/null | grep 11499
The test should fail unless the main page is applied.
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This UT got wrapped inside a transaction with autocommit=0 but
the rollback call was inadvertedly ommited. Adding it.
[RM note: an explicit rollback is not required, as the
transaction will roll back automatically at the end of
the DB session. Nonetheless, it hurts nothing to have
it be explicit.]
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch clears the subscription table so tests pass correctly if
there happens to have been a subscription with an end date before
2013-08-01.
To test
1/ Add a subscription in the serials module, with an end date before
2013-08-01
2/ run prove -v t/db_dependent/Bookseller.t
Notice tests 22 and 23 fail
3/ Apply patch
4/ run test again
5/ Notice tests succeed
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests now clean the subscription table before running
the tests, so that the will always pass.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch corrects a typo that broken ModReserveFill(). This
patch also adds a unit test that (via two levels of indirection)
exercises ModReserveFill().
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch makes Circulation_transfers.t no longer be sensitive to
the exact time it runs, avoiding spurious test failures due
to datesent being a second off between the creation of the test
transfer and the comparison.
To test:
[1] To simulate the failure, add a "sleep(2);" after the
"#Test GetTransfers" comment and run
prove -v t/db_dependent/Circulation_transfers.t
[2] Remove the sleep and apply the patch.
[3] Verify that prove -v t/db_dependent/Circulation_transfers.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
In various places, deleting a hold request did not trigger recalculating
the priority of the other holds on the bib:
To reproduce the bug:
- select or create 2 users U1 and U2
- select or create an holdable item
- place on hold for both U1 and U2. U1 has priority 1 and U2 has
priority 2.
- delete the hold for U1
- go on circ/circulation.pl?borrowernumber=XXXX for U2 (or in the DB
directly) and verify the priority has not been set to 1
The issue is repeatable (at least) on these 2 pages:
* circ/circulation.pl?borrowernumber=XXXX (tab 'Holds', select "yes"
in the dropdown list and submit the form)
* reserve/request.pl?biblionumber=XXXX (click on the red cross)
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Reran my tests:
Preparations:
- Create holds for different patrons on a record:
* 1st - title level hold
* 2nd - item level hold
* 3rd - title level hold
* 4th - title level hold
- AllowOnShelfHolds = On/Allow (items were not checked out)
Tests:
Deleted holds from various pages, confirming bugs first,
then testing with applied patches. Reloading database
after each test.
1) Cancel holds from OPAC patron account
/cgi-bin/koha/opac-user.pl#opac-user-holds
- Cancel 4th - ok, before and after applying the patch
- Cancel 2nd - ok, after applying the patch
2) Cancel hold from holds tab on staff detail page
/cgi-bin/koha/reserve/request.pl?biblionumber=7
a) Setting priority to 'del', submitting with 'Update holds'
- Cancel first (1st) - ok, before and after
- Cancel hold in the middle (was 3rd) - ok, before and after
- Cancel last (was 4th) -ok, before and after
b) Using red X
- Repeating tests from a) - before the patch is applied holds
get totally 'out of order' - after applying the patch, it works
correctly
Additional tests done on this page:
- Change priority using up, down, to top, to bottom icons
- Change priority with 'toggle to lowest'
3) Cancel hold from the patron's account
a) Check out tab - Delete? Yes, 'Cancel marked holds'
/cgi-bin/koha/circ/circulation.pl?borrowernumber=X
- Cancel first (1st) - ok, after applying the patch
- Cancel hold in the middle (was 3rd) - ok, after applying the patch
- Cancel last (was 4th) - ok, after applying the patch
b) Details tab - Delete? yes, 'Cancel marked holds'
/cgi-bin/koha/members/moremember.pl?borrowernumber=X
- Cancel first (1st) - ok, after applying the patch
- Cancel hold in the middle (was 3rd) - ok, after applying the patch
- Cancel last (was 4th) - ok, after applying the patch
Without the patch, holds priorities get out of order.
Additional tests done:
- Check in one item to trigger first hold
- Check in one item to trigger second hold
- Check out first item
Priorities are kept while the item is waiting, when it's
checked out, priorities of remaining holds get reset correctly.
Conclusion:
Big improvement, no regressions found.
Passes all tests in t, xt and QA script.
Also: t/db_dependent/Holds.t
t/db_dependent/HoldsQueue.t
t/db_dependent/Reserves.t
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test for using the MARC21
264 field in the Bibtex export.
To test:
[1] Verify that prove -v t/db_dependent/Record.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test for verifying that queued
SMS messages meant for patrons who have no SMS alert number
set are marked as failed after the first attempt to send them.
To test:
[1] Run prove -v t/db_dependent/Letters.t. The fourth
test should.
[2] Apply the main patch and run t/db_dependent/Letters.t
again. This time, all tests should pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch implements a regression test for verifying that
duplicate hold notifications aren't sent if ModReserveAffect() is
called repeatedly (as might happen if a circ operator accidentally
checks in an item and confirms its hold more than once).
Note that the test depends on the fact that _koha_notify_reserve()
defaults to sending a HOLD_PRINT letter if the borrower has not
specified an email or SMS hold notification.
To test:
[1] Run prove -v t/db_dependent/Reserves.t
[2] The 'patron not notified a second time (bug 11445)' test
should fail.
[3] Apply the main patch and run prove -v t/db_dependent/Reserves.t
again. This time all tests should pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The tests should be executed into a transaction and the SimpleSearch
routine correctly mocked.
Test plan:
Verify that prove t/db_dependent/XISBN.t returns green.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
A unit test fails in t/db_dependent/XISBN.t, the get_xisbn routine, if
ThingISBN is enabled, returns the 3rd biblionumber, not the second one.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds unit tests for two parts of DelItemCheck: checking
if the item is on loan, and checking if it is waiting on the hold
shelf.
To test:
[1] Verify that prove -v t/db_dependent/Circulation/IsItemIssued.t
is successful.
[2] Verify that prove -v t/db_dependent/Reserves.t is *not*
successful -- as it turns out, there was a latent bug where items
waiting on the hold shelf or in transit to fill a hold could still
be deleted without any warning.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
It is not necessary to process the case where the number of quotes
is just one, as int(rand(1)) will always produce 0, which is a valid
offset.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds new tests based on the db_dependent tests in
t/db_dependent/Koha.t for GetDailyQuote().
Tests run on an empty database and don't require Test::Deep.
Tests will fail before applying the patch for 11297, but will
pass after applying the patch.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Under certain circumstances, namely where QueryParser is off,
QueryWeightFields is on, and QueryFuzzy and QueryAutoTruncate are
off, a search with a double-quote embedded in it can fail: for
example
web application
would return results where
web "application
does not.
This patch adds an automated regression test.
To test:
[1] Apply this patch and run prove -v t/db_dependent/Search.t;
two tests should fail.
[2] After applying the main patch that fixes the bug, the
prove -v t/db_dependent/Search.t should succeed.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Looking at the TT plugin directory I notice we have some plugins that
seem to do the same thing:
KohaBranchName.pm
Branches.pm
This patch drops KohaBranchName in favor of Branches
Test Plan:
1) Apply this patch
2) View a basket group, note the branch name is displayed
3) View a subscription's details, note the branch name is displayed
4) View suggestions, note the branch names are displayed
5) Return an item that needs transfered, note the branch name is displayed
6) Run 'prove t/db_dependent/Koha_template_plugin_Branches.t'
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Also tested with a branch name with umlauts.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch ensures that the package-level cache is updated
when add_holiday() is used. Note that except for the test
case added by this patch, there doesn't seem to be anything
that actually calls ->add_holiday(); it may be better to remove it.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Fix the supplier, shipment date, and library filters
on the invoice search. An invoice's library is
(in parallel with order search) defined as the library
of the staff member that approved the basket. Before this
patch, the code was referring to an aqorders.branchcode
column that doesn't exist.
This patch also improves the author, title, ISBN/EAN/ISSN,
publisher, and publication year filters to no longer require
exact matches; substring matches now suffice.
Finally, this patch considers biblio.copyrightdate in addition
to biblioitems.publicationyear for publication date searches, as
the MARC21 frameworks use the former column but not the latter.
This patch also fixes the current test cases for invoices
so that they pass and adds regression tests.
Test plan:
[1] Create two invoices for different vendors.
[2] Do an invoice search and filter on shipment
date. Verify that the expected invoice(s)
are returned.
[3] Do an invoice search and filter on branch
(of the staff member that approved the basket).
Verify that the expected invoice(s) are returned.
[4] Do an invoice search and filter on supplier.
Verify that the expected invoice(s) are returned.
[5] Do invoice searches on author, title, ISBN/EAN/ISSN,
publisher, and publication year and verify that the
results are as expected.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Patch passes all tests, test plan and QA script.
(Adding from Katrin notes early) I agree with
Possible improvements:
- Document the behaviour of the library search as there are
lots of branches all over acquisitions with different meaning.
- Add the shipment date to the results list table
- Change label ISBN/EAN/ISSN to not include EAN for MARC21
installations
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test for Koha's ability
to gracefully handle records that Zebra will index but
which MARC::Record won't parse. In particular, MARC::File::USMARC
croaks on records that contain non-alphanumeric characters in the
tag name.
To test:
[1] After applying this test, run prove -v t/db_dependent/Search.t
The test script will die when it gets to the regression test.
[2] After applying the main patches that fix the bug, the test
script should pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
QueryParser was loading redundant search aliases, which in turn resulted
in certain queries involving two or more clauses joined by a Boolean
operator getting parsed in correctly.
To test:
[1] Enable QueryParser.
[2] Arrange your database so that some some bib records contain
the keyword 'history' while a smaller subset contain
both 'history' and 'earth'. (The exact words used don't
matter.)
[3] Run the following search from the OPAC global search bar:
kw:history && kw:earth
[4] Observe that the records that are returned include *all* bibs
in the database with the keyword 'history'. In other words, the
restriction that the records must also contain 'earth' is not
observed.
[5] Apply the patch and rerun the search.
[6] This time, the results that are returned should include only those
that contain both 'history' and 'earth'.
[7] Verify that prove -v t/QueryParser.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes test plans, all tests and QA script.
Also checked the db_dependent/Search.t tests.
Tried some other searches, all seems to be working correctly.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
I reproduce the bug and I confirm this patch fixes it.
Without the patch, kw:history && kw:earth, I got:
Search biblios OK 4 1 1+0 RPN @attrset Bib-1 @attr 4=6 @attr 1=1016 history
With the path, I get:
Search biblios OK 2 1 1+0 RPN @attrset Bib-1 @and @attr 4=6 @attr 1=1016 history @attr 4=6 @attr 1=1016 earth
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds regression tests to verify that
Boolean searches using QueryParser function correctly.
This patch also ensures that QP is correctly initalized
when Search.t is run.
To test:
[1] Apply this patch and the following patch.
[2] Verify that prove -v t/QueryParser.t works
[3] Verify that prove -v t/db_dependent/Search.t works
[4] (optional) instead of applying both patches at the same
time, apply only the regression test patch and run the
tests listed in steps 2 and 3. The following tests
should fail:
t/db_dependent/Search.t (Wstat: 512 Tests: 198 Failed: 2)
Failed tests: 42, 71
Non-zero exit status: 2
t/QueryParser.t (Wstat: 256 Tests: 28 Failed: 1)
Failed test: 12
Non-zero exit status: 1
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Fixing some things the QA script pointed out this morning:
- whitespace
- variable declaration
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Changes tests for GetUpcomingDueIssues:
days_in_advance should be inclusive:
2 should find items due in 2 days from now.
1 should find items due tomorrow.
0 should only find items due today.
Adds new tests for Bug 11218:
As the advance_notices.pl, the only script using GetUpcomingDueIssues
is not only used for PREDUE notices, but also for
DUE notices, we need to also select items due today.
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 8015: Fix complains from qa tools
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: Get rid of the eval in ModifyRecordWithTemplate
This patch removes the use of eval in the
C4::MarcModificationTemplates::ModifyRecordWithTemplate routine.
Now this routine call the wanted modification routine with the list of
parameters.
This call is done only if the condition is respected.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: Get rid of eval for evaluating =~ m//
Koha::SimpleMarc::field_equals uses eval in order to check if a string
matches a pattern.
Now this eval is removed and the "regex" variable does not contain the
regex separated character (/ or |).
Regression: Before this patch, the user was able to user a modifier. Now
it is not possible.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: Get rid of the eval for substitution
Before this patch, the regex substitution was contain into only one
variable (e.g. my $regex = "/foo/bar/i").
Now each member of the regex is stored into a field in the
marc_modification_template_actions sql table.
In order to avoid a complex code, only modifiers i and g are take into
account.
Note: If you already add the mmta table, you have to drop it.
This patch also adds a foreign key from mmta to mmt tables.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: FIX ui issue
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: The template name is a required field
Test plan:
Try to add a template with an empty string as name.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Previous version does not create the biblio.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch moves the GetBudgetByOrderNumber() test from
Budgets.t to Acquisition.t, thereby making it easier to
test without doing a direct SQL insert into the aqorders table.
To test:
[1] Verify that prove -v t/db_dependent/Budgets.t passes
[2] Verify that prove -v t/db_dependent/Acquisition.t passes
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a more extensible and flexible debarments system to Koha. The fields
borrowers.debarred and borrowers.debarredcomment are retained for compatibility and
speed.
This system supports having debarments for multiple reasons. There are currently
three types of debarments:
OVERDUES - Generated by overdue_notices.pl if the notice should debar a patron
SUSPENSION - A punative debarment generated on checkin via an issuing rule
MANUAL - A debarment created manually by a librarian
OVERDUE debarments are cleared automatically when all overdue items have been returned,
if the new system preference AutoRemoveOverduesRestrictions is enabled. It is disabled
by default to retain current default functionality.
Whenever a borrowers debarments are modified, the system updates the borrowers debarment
fields with the highest expiration from all the borrowers debarments, and concatenates
the comments from the debarments together.
Test plan:
1) Apply patch
2) Run updatedatabase.pl
3) Verify the borrower_debarments table has been created and
populated with the pre-existing debarments
4) Run t/db_dependent/Borrower_Debarments.t
5) Manually debar a patron, with an expiration date
6) Verify the patron cannot be issued to
7) Add another manual debarment with a different expiration date
8) Verify the 'restricted' message lists the date farthest into the future
9) Add another manual debarment with no expiration date
10) Verify the borrower is now debarred indefinitely
11) Delete the indefinite debarment
12) Verify the debarment message lists an expiration date dagain
13) Enable the new system preference AutoRemoveOverduesRestrictions
14) Set an overdue notice to debar after 1 day of being overdue
15) Check out an item to a patron and backdate the due date to yesterday
16) Run overdue_notices.pl
17) Verify the OVERDUES debarment was created
18) Return the item
19) Verify the OVERDUES debarment was removed
20) Disable AutoRemoveOverduesRestrictions
21) Repeat steps 15 though 18, verify the OVERDUES debarment was *not* removed
22) Add issuing rules so that an overdue item causes a temporary debarment
23) Check out an item to a patron and backdate the due date by a year
24) Return the item
25) Verify the SUSPENSION debarment was added to the patron
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch also corrects an error in the description of
NewSubscription().
Named parameters for this function cannot come soon enough.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
These tests are split in two parts: "db dependent" and "db
independent".
GetNextSeq requires DB only when checking for irregularities.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
A lot of tests were just a call to a funtion without any arguments,
whereas the function expect at least one argument.
These tests were kept, but all return values are now undef when a
mandatory argument is missing, so return values are consistent.
The part where subscription periodicity is changed could not work
because of ',' appended to each key in ModSubscription call. So it's
rewritten, taking into account the new API for subscription frequencies.
This script should leave your database intact because it revert any
modification made.
Also fix some warnings in C4::Serials and in C4::Items.
And fix a typo in koha-tmpl/.../subscription-numberpatterns.tt
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Work as described. No errors
Tested, again, without trouble.
With a suscription, tests successful.
No koha-qa errors
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test for doing a form-based catalog
search using an index that contains the string 'ns' in its name. In
this case, the index being tested is 'Code-institution'.
To test
-------
[1] Prove -v t/db_dependent/Search.t should have two failed tests;
one each for GRS-1 and DOM testing.
[2] After applying the main patch for this bug, the tests should
pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
[1] Fix regression on bug 10663
Looks like the regression was introduced by a glitch during rebasing.
[2] Fix errors in Circulation_issue.t
The change in AddRenewal() turned up an issue with how the test
script issued one of the test items.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch uses understandable codes instead of magical numbers for the
aqorders.orderstatus field.
+ execute sql queries in unit tests into a transaction.
Signed-off-by: Pierre Angot <tredok.pierre@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Right now there is no way to change the budget or fund when receiving an
item, which is annoying, particularly at the end of the fiscal year when
every item not already received has to be switched to the following
year's budget. This patch adds the ability to change the budget and fund
when receiving.
To test:
1) Apply patch.
2) Create an order for a vendor, choosing a fund to use for that order.
3) Receive the order, leaving the fund unchanged. Make sure the fund
did not change.
4) Create another order for a vendor, choosing a fund to use for that
order.
5) Receive the order, this time changing the fund. Make sure the fund
is changed.
6) Run the unit test:
> prove t/db_dependent/Acquisition.t
7) Sign off.
(Notes: this patch depends on the Acquisitions.t unit test improvements
in bug 10274; the seemingly-unrelated change in SQLHelper quiets an
irritating warning caused by the NewOrder call in ModReceiveOrder)
Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Given how easy it is to accidentally receive items from one invoice on
multiple invoices, the ability to merge invoices can be quite handy.
This patch adds that ability to Koha's Acquisitions module.
To test:
1) Apply patch.
2) Run unit test:
> prove t/db_dependent/Acquisition/Invoices.t
3) Create two invoices from the same vendor for merging, and receive at
least one order on each.
4) Do a search on the Invoices page that brings up both the invoices you
created.
5) Check the boxes next to the two invoices.
6) Click "Merge selected invoices."
7) Choose which invoice you want to keep (the default will be the first).
8) Click "Merge."
9) Confirm that the resulting invoice has all the orders you received
listed on it.
10) Sign off.
Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Merged several invoices sucessfully - with and without received
orders, open and closed. Works nicely.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
In particular, verify that the pending filter option works.
To test:
[1] Verify that prove -v t/db_dependent/Acquisition.t passes
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
In the C4::Acquisition module, 2 routines do the same work. This patch
merges these 2 routines.
Test plan:
test the acqui/orderreceive.pl, acqui/uncertainprice.pl
and serials/acqui-search-result.pl, acqui/parcel.pl scripts.
Note: on acqui/parcel the basket filter is a search on basket name (was
on basket id, which was not relevant).
Signed-off-by: Pierre Angot <tredok.pierre@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pm, no adverse bahaviors noted. All sub calls updated.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch also temporarily removes any existing
budgets to avoid issues where tests can fail if there
is already an active budget in the database.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This adds a test case for the new default sort
order for GetBudgets().
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The patron lists feature is somewhat similar to the record lists feature
in that it allows a librarian to create a list of patrons for later
retrieval and manipluation. These lists can then be used with the batch
patron modification tool.
Test Plan:
0) Apply the patch for Bug 8798
1) Apply this patch
2) Run updatedatabase.pl
3) Access the patron lists feature from Koha's Tools menu.
4) Create a new list via the "New patron list" button.
5) For this list, click the "Edit" button, and change the list name.
6) For this list, click the "Add patrons" button, and search for and
add some patrons to your list.
7) For this list select some patrons to remove them.
8) Try both adding some new patrons, and removing some old patrons
as a single action.
9) Click the "Patrons" link on the Koha toolbar
10) Search the patrons, or browse by letter to get patron results
11) Check the checkboxes next to one or more patrons, and add the
selected patrons to your existing list.
12) Change the "Selected patrons" pulldown to "All resultant patrons"
and add them to your list.
13) Check the checkboxes next to one or more patrons, and add the
selected patrons to a new list.
14) Try manipulating a list of patrons using the batch patron
modification tool.
15) Go back to the Patron Lists feature and delete your lists.
16) Run 'prove t/db_dependent/PatronLists.t'
Signed-off-by: Nora Blake <nblake@masslibsystem.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This adds a test to verify that the public subscription
note is returned by a subscription search.
To test:
[1] Verify that t/db_dependent/Bookseller.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch gives Koha the ability to merge authority records using the
same interface used by bibliographic records, though slightly different
methods for selecting which records to merge. The two ways to select
records are as follows:
1) Records can be selected from authority search results by clicking
the "Merge" link for two records.
2) Authority records can be merged from the reservoir by clicking the
merge-related links in the Manage staged MARC batch screen.
To test:
1) Apply patch.
2) Do a search for an authority record that will turn up multiple
identical records (or at least two records that you don't mind
merging).
3) Click the "Merge" link for the first record.
4) Click the "Merge" link for the second record.
5) Choose which fields from which record you want to appear in the
resulting record.
6) Confirm that those are the fields that exist in the resulting record.
7) Stage an authority record (for example, an authority record you
saved from your catalog.
8) Search for a record to merge with it using the "Search for a record
to merge in a new window" link.
9) Merge these records, confirming that the resulting record (after
going through the entire merging process) matches your expectations.
10) Set up a matching rule for authorities, and export an authority from
your catalog that will match based on that rule. For MARC21, the
following is a good choice for a rule:
Matching rule code: AUTHPER
Description: Personal name main entry
Match threshold: 999
Record type: Authority record
[Match point 1:]
Search index: mainmainentry
Score: 1000
Tag: 100
Subfields: a
11) Stage the record you just exported, choosing the matching rule you
just created.
12) Merge the record using the "Merge" link, confirming that the
resulting record (after going through the entire merging process)
matches your expectations.
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch in series.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch enhances t/db_dependent/Search.t to test indexing and
searching of authority records. It supplies a sample authority file
for MARC21 (consisting of the record for William Shakespeare from the
Library of Congress) and a sample UNIMARC authority file supplied
by Henri-Damien Laurent.
It also adds tests for both MARC21 and UNIMARC authorities.
When the main patch for bug 7421 is applied, t/db_dependent/Search.t
should pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test that verifies that searching the
UNIMARC 'item' index for a value that is indexed by virtue of being
included in the fallback index definition for the 995 field works for
both GRS-1 and DOM.
The main patch will allow t/db_dependent/Search.t to pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a few basic search and indexing tests for UNIMARC,
using sample data provied by Frédéric Demians. The new tests
by no means completely cover the possibilities, but should be
considered a starting point for future tests.
To test:
[1] Verify that prove -v t/db_dependent/Search.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch refactors t/db_dependent/Search.t so that it can be
subsequently modified to add tests for indexing and searching
UNIMARC records without duplicating the setup code.
This patch also moves the MARC21 records from t/db_dependent/data/zebraexport
to t/db_dependent/data/marc21/zebraexport so that UNIMARC sample
data can be slotted in t/db_dependent/data/unimarc/zebraexport.
To test:
[1] Verify that prove -v t/db_dependent/Search.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
There was some churn in previous patches about the desired
name of the music publisher number index, so this patch
adds tests to confirm that both the old and new names
work as CCL keywords.
To test:
[1] Verify that t/db_dependent/Search.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch expands t/db_dependent/Search.t to run
the same tests using both the GRS-1 and DOM indexing
modes. It also adds hooks in zebra_config.pl to make
it easier to stage test cases for non-MARC21 Zebra
indexing.
Note that in DOM mode one of the tests is currently a
TODO, as relevance ranking for wegihted queries differs
between GRS-1 and DOM.
To test:
[1] Verify that prove -v t/db_dependent/Search.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch updates the unit tests for the BibTeX export
to add a regression test for supplying the author for
non-UNIMARC records. It also adjusts the test to reflect
the change in quote character from "" to {}.
To test:
[1] Verify that prove -v t/db_dependent/Record.t passes
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch fixes some incoherences of the routine
GetBooksellerWithOrders().
Now it considers the field $estimateddeliverydateto and it replaces it
by now() only if it is undef.
Also, it doesn't test if $aqbookseller.deliverytime is not Null anymore
but if $deliverytime = null or undef, it replaces it by 0.
It also verifies if $delay is >= 0 and return undef if it is a negative
value.
To Test:
Before, this routine sorts out the BookSellerWithLateOrders. If a
bookseller did not specify a deliverytime, it would never appears in
the list of LateOrders. Moreover, if the field "Estimated delivery
date to" was specified, it didn't take care of the value and it
returns the late order up to today's date.
Now, the returned list considers all the fields give and if the
delivery time of the bookseller is not specified, it calculates the
late orders as if the deliverytime is 0. By default, all booksellers
which have orders in late until today are listed unless "estimated
delivery date to" is specified.
prove t/db_dependent/Bookseller.t
t/db_dependent/Bookseller.t ..
[Some warnings about uninitialized values]
WARNING: GetBooksellerWithLateOrders is called with a negative value at C4/Bookseller.pm line 135.
t/db_dependent/Bookseller.t .. ok
All tests successful.
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The borrowers table needs to be cleared after the items table
(last_returned_by column).
Some checks were missing for GetRenewCount and AddRenewal.
Now the tests simulated a renewal for a item and check that the renews
left is decremented.
Moreover the issuingrules tables should be cleared and filled with known
values.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds some unit tests wrapped in a transaction for
C4::Circulation.pm.
Circulation_Branch.t adds tests for routines which deal with
branch_item_rules,branch_borrower_circ_rules,
default_branch_circ_rules, default_circ_rules, and
default_branch_item_rules in the database.
Circulation_issue.t adds tests for routines which deal with accountline
and issues in the database.
NOTE: Some commented tests have to be fixed, and some tests can be added.
More, other routines of Circulation.pm are tested in the patches:
10692 UT: Routines about transfers in Circulation.pm need unit tests
10710 UT : OfflineOperation's routines in C4/Circulation.t need unit tests
10767 UT: Routines which interact with the table issuingrules in C4/Circulation need unit test
Test plan:
prove t/db_dependent/Circulation_issue.t
t/db_dependent/Circulation_issue.t .. ok
All tests successful.
Files=1, Tests=16, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.40 cusr 0.02 csys = 0.44 CPU)
Result: PASS
prove t/db_dependent/Circulation_Branch.t
t/db_dependent/Circulation_Branch.t .. ok
All tests successful.
Files=1, Tests=10, 2 wallclock secs ( 0.06 usr 0.00 sys + 1.02 cusr 0.06 csys = 1.14 CPU)
Result: PASS
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Well, I don't know exactly what to do with this, so
I left it to QA
a) prove t/db_dependent/Circulation_Branch.t works well and without erros
b) prove t/db_dependent/Circulation_issue.t works without errors for me
ONLY if I have a issuingrule for All, All with 1 as renewals allowed, in
other cases it fails.
No koha-qa errors
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds return values to DeleteTransfer:
Undef if no parameters are given
1 if a Transfer is deleted
0E0 if a wrong parameter is given
It also fixes some unit tests in t/db_dependent/Circulation_transfers.t
To test:
prove t/db_dependent/Circulation_transfers.t
t/db_dependent/Circulation_transfers.t .. ok
All tests successful.
Files=1, Tests=14, 20 wallclock secs ( 0.03 usr 0.00 sys + 0.39 cusr 0.02 csys = 0.44 CPU)
Result: PASS
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Applied 10681 and 10692 before 10698
Run prove t/db_dependent/Circulation_transfers.t without errors
No koha-qa errors on all 3 patches
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The move avoids a problem where many modules would gain
a dependency on C4::Auth just because C4::Members needs access
to hash_password().
This patch also adds a couple unit tests for the new password
hashing code.
To test:
[1] Verify that there are no regressions on the test plan for bug
9611.
[2] Verify that t/AuthUtils.t and t/db_dependent/Auth.t pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The next and previous links should completely refresh the shelf.
For example:
[<] [1] [2] [3] [4] [5] [6] [>]
Before this patch, the next and previous links were the same as the 1
and 6.
With this patch, after clicking on next, we will get:
[<] [7] [8] [9] [10] [11] [12] [13] [>]
This patch adds a new AJAX script to get the shelf browser block.
Test plan:
- On a detail biblio page, click on a "Browse shelf" link.
- Play with the next and previous links.
- Deactivate Javascript (using NoScript for example) and check that you
get the same behavior (but the page is reloaded).
- Launch the unit tests: prove t/db_dependent/ShelfBrowser.t
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Galen found a case where the cookies array was not built flat. I add a
unit test for that (check the cookie array is flat) and also test the
cookies output of get_template_and_user so we are sure the &language=
parameter is correctly handled.
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
- Tests in t/db_dependent/Auth.t pass
- Tested in intranet, OPAC logged in, OPAC logged out
* Adding a valid language code to the URL switches the language
as expected
* Adding an invalid language code causes no change
Nice feature!
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10925 removes the last call to C4::Utils.
The module becomes useless and can be deleted.
Verify that t/db_dependent/Context.t still successfully passes.
git grep hashdump
git grep maxwidth
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, no subs from the module are used anywhere
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This fixes a regression introduced by the patch for bug
9394 -- when printing a hold slip using the 'print and confirm'
button, the slip would contain only the text 'reserve not found',
not a full hold slip.
This patch also adds a regression test.
To test:
[1] Check in an item that would fill a hold. Use the 'print
and confirm button' to confirm the hold.
[2] The printout will only contain text to the effect of
'reserve not found'.
[3] Apply the patch.
[4] Repeat step 1. This time, a full hold slip should be printed.
[5] Verify that prove -v t/db_dependent/Reserves.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Pass all tests, new and old, and QA script.
Verified wrong and corrected behaviour.
Note: Sometimes there will not be the message 'reserve not found'
showing up, but hold information for a different record. This happens
when there exists a reserve_id with the borrowernumber of the patron
in question in your database.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Adds tests for CheckReserves with lookahead parameter.
Adds tests for AddReturn with regard to future reserve messages.
The following test cases are added, resulting in 8 new tests:
a) Add a reserve without date, CheckReserve should return it
b) Add a reserve with future date, CheckReserve should not return it
c) Add a reserve with future date, CheckReserve should return it if lookahead
is high enough
d) Check ResFound message of AddReturn for future hold
Test plan:
Run the test. No fails?
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Optionally add some branches and categories that may not exist.
Test plan:
Run the test with or without CPL branch or S (staff) category.
Verify that the test does not fail.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This adds unit test for the new methods in C4::BackgroundJob. One
of the tests verfies that setting extra values does not scribble over
data that is mean to be internal to the C4::BackgroundJob object.
To test:
Verify that prove -v t/db_dependent/BackgroundJob.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Sometimes when using the batch item modification tool, we would like to
automatically uncheck on loan items.
This patch also adds a new routine in C4::Circulation, IsItemIssued(),
which, when passed an itemnumber, returns whether the item is
currently on loan.
Test plan:
1/ Go to tools/batchMod.pl.
2/ Enter some barcode (at least 1 should be on loan).
3/ Click on the Continue button.
4/ Click on the "Clear on loan" link.
5/ Check that on loan items are unchecked.
Launch the unit test file:
prove t/db_dependent/Circulation/IsItemIssued.t
http://bugs.koha-community.org/show_bug.cgi?id=10572
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Works as expected, only modifies items that are checked (still). No regression noted.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds several unit tests for GetHiddenItemnumbers and fixes the POD for it.
It also wraps the tests for rollback, modernizes and adds a license text to it.
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
I fixed a redundant 'my' that the QA script pointed out.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch prevents a spurious test case failure if the
test database happens to already have a library whose
code is 'UT'.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Test authentication via ILS-DI:
- with userid and password
- with userid and wrong password
- with cardnumber and password
- with cardnumber and wrong password
...
Before the patch only userid will authenticate the patron.
After the patch was applied, userid and cardnumber will work.
To test:
- Run t/db_dependent/ILSDI_Services.t - all tests should pass.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No koha-qa errors
Test:
Enable ISL-DI
access opac with /cgi-bin/koha/ilsdi.pl?service=AuthenticatePatron&username=XXX&password=YYY
With userid/cardnumber & password returns borrowernumber
With userid/cardnumber & wrong password returns PatronNotFound
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds unit tests for Authenticate patron.
To test:
- Run perl t/db_dependent/ILSDI_Services.t
- Verify all tests pass
Note: there are some tests marked as TODO.
Rewriting AuthenticatePatron to make cardnumber and userid
work for authenticating a patron will be implemented in the
next patch. Tests related to this are currently showing as
'not ok', but are still passing.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No koha-qa errors
With both patches applied, all test pass.
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: sonia <koha@univ-lyon3.fr>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signing off on this because a following patch fixes the test to use
transactions
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Before, ModBookseller always returns undef. This patch modifies it in
order to be more explicit.
Now it returns :
1 -> If a modification has been done
0E0 -> If the given ID doesn't exist
undef -> If no ID given
It also fixes one of the tests which didn't pass before
in t/db_dependent/Bookseller.t
To Test:
prove t/db_dependent/Bookseller.t
Bookseller.t .. 1/54
[Some warnings about uninitialized values]
t/db_dependent/Bookseller.t .. ok
All tests successful.
Files=1, Tests=54, 1 wallclock secs ( 0.03 usr 0.00 sys + 0.46 cusr 0.04 csys = 0.53 CPU)
Result: PASS
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Change is logical and passes new and old tests.
Fixed the author line to have Kenza's correct email address.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch makes DelBookseller returns the number of suppliers it has
deleted or undef if an error has occurred.
It also fixes a test which doesn't pass before in t/db_dependent/Bookseller.t
To test:
prove t/db_dependent/Bookseller.t
t/db_dependent/Bookseller.t .. 1/54
All tests successful.
Files=1, Tests=54, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.48 cusr 0.02 csys = 0.52 CPU)
Result: PASS
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Logical change and makes another test pass :)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch updates the wthdrawn field in items and deleteditems to be
withdrawn instead. No functional changes are made.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Save for translation files (that will be fixed on next release),
only occurrence of wthdrawn is on updatedatabase.pl
No koha-qa errors.
This touch many files, and I did not test everything,
but all seems normal. I think that any problem could
be fixed later.
Perhaps both entries in updatedatabase.pl could be joined
into one, but thats for QA.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds a regression test for this bug, effectively
implementing the manual test plan in the previous patch.
To test:
[1] Verify that prove -v t/db_dependent/Reserves.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
CheckReserves was using the CircControl system preference to determine what
patrons an item can fill a hold for. It should be using ReservesControlBranch
instead.
Test Plan:
1) Set ReservesControlBranch to "item's home library".
2) Create an item at Library A, place holds for it for patrons at
Library B, Library C, and Library A in that order,
for pickup at the patrons home library.
3) Make sure the holds policy for Library A is set to
Hold Policy = "From home library" and
Return Policy = "Item returns home".
Make sure the holds policies for the other libraries are set to
Hold Policy = "From any library".
4) Check the item in at Library C, the hold for the patron at Library B
should pop up, even though it's in violation of the circulation rules.
Don't click the confirm button!
5) Apply this patch, and reload the page,
now the hold listed should be for the last hold,
the hold for the patron at Library A, which is correct.
This patch adds the subroutine C4::Reserves::GetReservesControlBranch as
an equivilent to C4::Circulation::_GetCircControlBranch.
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixed POD so that arguments and explanation match (C<$item>).
Also tested opac-reserves.pl for regressions.
Passes all tests, QA script, and Reserves.t.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds regression tests to verify the sort
order when fetching authorised values in either staff
or OPAC mode.
This patch also wraps the Koha.t tests in a transaction, and
better handles skipping tests if Test::Deep is not installed.
To test:
[1] Verify that prove -v t/db_dependent/Koha.t passes
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass with all patches applied.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Makefile.PL: Section for creating file t/test-config.txt removed.
Removes t/Makefile and t/rewrite-config-test too.
Modifies XISBN.t to remove two commented lines.
Test plan:
Grep for KohaTest, database_dependent, config-test, t/Makefile.
Run perl Makefile.PL and include running the test suite.
This may fail on t/00-valid-xml.t and t/QueryParser.t, but that is not the
result of this patch. Same for t/00-load.t with potential error on
Koha::Plugins::Base.
I had this result:
Test Summary Report:
t/00-valid-xml.t (Wstat: 1792 Tests: 381 Failed: 7)
Failed tests: 10, 30-31, 169, 181, 201-202
Non-zero exit status: 7
t/QueryParser.t (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: No plan found in TAP output
Files=92, Tests=12385, 45 wallclock secs ( 1.74 usr 0.15 sys + 26.61 cusr 1.92 csys = 30.42 CPU)
Result: FAIL
Failed 2/92 test programs. 7/12385 subtests failed.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
All tests pass, and I find no mention of the removed test code.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch removes all files in lib/KohaTest and the associated script
t/db_dependent/database_dependent.pl.
The second patch deals with a few consequences.
Note that bug 10540 has been opened to save some interesting code from these
unit tests and inject them in the currently used t/db_dependent suite.
Test plan:
See second patch.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This adds tests for the new PurgeSearchHistory function and
AddSearchHistory. GetSearchHistory is not tested due to its
current broken state (see bug 10667).
To test:
[1] Run prove -v t/db_dependent/Search_SearchHistory.t
[2] Verify that all tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch adds return values to DeleteBranchTransferLimits:
1 if a Transfer Limit is deleted
undef if no parameters is given
0E0 if a wrong parameter is given
More, it fixes and adds some tests in t/db_dependent/Circulation_transfers.t
To test :
prove t/db_dependent/Circulation_transfers.t
t/db_dependent/Circulation_transfers.t .. ok
All tests successful.
Files=1, Tests=14, 19 wallclock secs ( 0.02 usr 0.01 sys + 0.39 cusr 0.02 csys = 0.44 CPU)
Result: PASS
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested with patch for bug 10692 applied.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch test if the parameters $toBranch and $fromBranch are given.
If not, CreateBranchTransferLimit now returns undef.
This patch also fixes and adds some regression tests in
t/db_dependent/Circulation_transfers.t
NOTE:
Currently, we can add a transferlimit to nonexistent branches because
in the database branch_transfer_limits.toBranch
and branch_transfer_limits.fromBranch aren't foreign keys.
To test:
prove t/db_dependent/Circulation_transfers.t
t/db_dependent/Circulation_transfers.t .. ok
All tests successful.
Files=1, Tests=15, 18 wallclock secs ( 0.02 usr 0.01 sys + 0.42 cusr 0.00 csys = 0.45 CPU)
Result: PASS
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
The tests are wrap in a transaction.
NOTE: Currently, some tests should pass but don't because of incoherences in the code.
These tests are in comments and preceded by FIXME.
To test:
prove t/db_dependent/Circulation_transfers.t
t/db_dependent/Circulation_transfers.t .. ok
All tests successful.
Files=1, Tests=12, 18 wallclock secs ( 0.02 usr 0.01 sys + 0.37 cusr 0.06 csys = 0.46 CPU)
Result: PASS
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Also, I prefer the use of parentheses for function
calls, even when no arguments are being passed.
One missed comma turns
is(GetOfflineOperation, ...)
into
is(GetOfflineOperation ...)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch test AddOfflineOperation,GetOfflineOperation and
DeleteOfflineOperation in C4/Circulation.pm.
The tests are wrapped in a transaction.
Note: Currently, GetOfflineOperations is not tested because we cannot
mock C4::Context->userenv in unit tests
To test:
prove t/db_dependent/Circulation_OfflineOperation.t
t/db_dependent/Circulation_OfflineOperation.t .. ok
All tests successful.
Files=1, Tests=7, 19 wallclock secs ( 0.01 usr 0.01 sys + 0.33 cusr 0.02 csys = 0.37 CPU
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The FIXME comments in the new test script were based on
an assumption that GetIssuingRules() should return
multiple rules if no or only partial parameters are
passed. This is not the intent of that routine, whose
purpose is to return the *singular* rule that best
applies to a given loan situation. In other words,
GetIssuingRule() is not a traditional accessor function.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The test are wrap in a transaction.
To test:
prove t/db_dependent/Circulation_Issuingrule.t
t/db_dependent/Circulation_Issuingrule.t .. ok
All tests successful.
Files=1, Tests=9, 17 wallclock secs ( 0.02 usr 0.00 sys + 0.34 cusr 0.04 csys = 0.40 CPU)
Result: PASS
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: No koha-qa errors
prove t/db_dependent/Circulation_Issuingrule.t run without errors
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Unit tests are wrap in a transaction.
To test:
prove t/db_dependent/Branch.t
t/db_dependent/Branch.t .. 1/36 Using a hash as a reference is deprecated at t/db_dependent/Branch.t line 207.
t/db_dependent/Branch.t .. ok
All tests successful.
Files=1, Tests=36, 1 wallclock secs ( 0.02 usr 0.02 sys + 0.13 cusr 0.01 csys = 0.18 CPU)
Result: PASS
http://bugs.koha-community.org/show_bug.cgi?id=10508
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The tests are wrapped in a transaction.
NOTE: some tests should pass but doesn't because of incoherences in
the code. These tests are in comments and preceded by FIXME
Test plan:
prove t/db_dependent/Bookseller.t
t/db_dependent/Bookseller.t .. 15/53
[Some warnings about uninitialised values]
t/db_dependent/Bookseller.t .. ok
All tests successful.
Files=1, Tests=53, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.46 cusr 0.03 csys = 0.51 CPU)
Result: PASS
http://bugs.koha-community.org/show_bug.cgi?id=10528
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
The new tests pass nicely, as do all old tests and the QA script.
All patches marked as dependencies have been pushed to master
already.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Some unit tests related to Bug 9362.
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
http://bugs.koha-community.org/show_bug.cgi?id=10606
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
New and old tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
As with commit 8f933bc04, Perl 5.14's support for array and hash
container functions accepting hashrefs and arrayrefs is a syntax
error in Perl 5.10.
To test:
Verify that t/db_dependent/Reports_Guided.t passes when run under
a Perl version older than 5.14.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
1/ delete_report should return undef is no parameter is given.
2/ delete_report returns the number of affected rows.
3/ delete_report should be tested with 1 and more parameters.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The test are wrapped in a transaction.
Note : The last test (in comment) currently doesn't pass because it
needs some modifications of delete_report.
To test:
prove t/db_dependent/Reports_Guided.t
t/db_dependent/Reports_Guided.t .. ok
All tests successful.
Files=1, Tests=7, 0 wallclock secs ( 0.01 usr 0.01 sys + 0.28 cusr 0.02 csys = 0.32 CPU)
Result: PASS
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works nicely, tested with patch for bug 10761 applied.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
For some reason, C4::HoldsQueue::MapItemsToHoldRequests used the system
preference AutomaticItemReturn to decide if an attempt to fill local
holds with local items. No explanation of this behavior is provided.
This patch removes this behavior, and also adjusts the calculation
of the lead-cost library to always return the pickup library if it
is on the list of libraries that could fill the hold -- on the
basis that if the item is already at the pickup library, its
transport cost is inherently zero.
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes QA script and adds unit tests.
Tested with some examples and those worked correctly.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Koha::DateUtils::dt_from_string() and DateTime->now() are
not equivalent -- they don't handle timezones in the same
way.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Follow-up fixing some and adding more unit tests.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Initial work on unit tests for CanBookBeRenewed. More scenarios are needed.
Also made Circulation.t use autocommit=0.
Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This makes the POD for the columns() function consistent
with the rest of C4/Members.pm. It also removes a note
that can be relegated to the bug report and the Git
history.
Also, since C4::Members::columns() is not actually a
class method, this patch changes the invocation to
not call it that way.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The initial thought was to remove this function. However,
tools/import_borrowers.pl uses it. So rather than remove
it to solve the problem, it was reworked to a more generic
solution which runs faster.
By accessing $sth->{NAME} directly, the driver becomes
responsible for filling it correctly. This happens when a SELECT
is done on the borrowers table. It does not even have to have
data in the result set!
The columns method could be more generic and used elsewhere too.
Comparison between the old method and the STH method showed a
significant time difference. The old method took 35 seconds
for 40k iterations versus 19 seconds for the same amount of
iterations with the STH method regardless of the size of the
borrowers table.
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Perl 5.14 changed array and hash container functions (e.g., keys())
to accept hashrefs or arrayrefs. However, this doesn't work in
Perl 5.10, so doing
scalar(keys( function_returning_hashref() ) );
is a syntax error in that version. This patch changes the affected
tests to explicitly difference the hashrefs returned by the various
functions.
To test:
Verify that t/db_dependent/ClassSource.t passes.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
If IndependentBranches is ON and canreservefromotherbranches is OFF,
a patron is not permittedo to request an item whose homebranch (i.e.,
owner of the item) is different from the patron's own library.
However, if canreservefromotherbranches is turned ON, the patron can
create such hold requests.
Note that canreservefromotherbranches has no effect if
IndependentBranches is OFF.
To test, run prove -v t/db_dependent/Holds.t. Without the bugfix
patch for bug 2394, the last two tests should fail.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This unit tests file does not need the t::lib::Mocks::Context module.
To test:
prove t/db_dependent/Circulation_issuingrules.t
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, test checks out.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
In t/db_dependent/Koha.t, the test "Got a quote based on today's
date" is failing :
$prove t/db_dependent/Koha.t :
t/db_dependent/Koha.t .. 1/6
# Failed test 'Got a quote based on today's date.'
# at t/db_dependent/Koha.t line 126.
# Compared $data->{"source"}
# got : 'Herbert Hoover'
# expect : 'Abraham Lincoln'
# Be sure to run this test on a clean install of sample data.
# Looks like you failed 1 test of 4.
Looks like the wrong quote is returned by GetDailyQuote().
I'm using a databased created with the English sample SQL datas.
I think I found the cause :
The test "Got a random quote." calls GetDailyQuote('random'=>1) which
changes the quote timestamp to now. When then testing GetDailyQuote(),
this quote (which may not be the one created by test) is the most
recent quote.
This patch moves the "Got a random quote." test after "Got a quote
based on today's date" to solve the problem.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The tests are wrapped in a database transaction.
To test:
prove t/db_dependent/ClassSource.t
t/db_dependent/ClassSource.t .. 1/24 prepare_cached(SELECT * FROM `class_sort_rules` WHERE `class_sort_rule` = ?) statement handle DBI::st=HASH(0x92dbedc) still Active at C4/ClassSource.pm line 249
prepare_cached(SELECT * FROM `class_sources` WHERE cn_source = ?) statement handle DBI::st=HASH(0x926876c) still Active at C4/ClassSource.pm line 137
attempting to use non-existent class sorting routine routine1
prepare_cached(SELECT * FROM `class_sort_rules` WHERE `class_sort_rule` = ?) statement handle DBI::st=HASH(0x92dbedc) still Active at C4/ClassSource.pm line 249
prepare_cached(SELECT * FROM `class_sources` WHERE cn_source = ?) statement handle DBI::st=HASH(0x926876c) still Active at C4/ClassSource.pm line 137
t/db_dependent/ClassSource.t .. ok
All tests successful.
Files=1, Tests=24, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.12 cusr 0.01 csys = 0.15 CPU)
Result: PASS
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The actual tests in this script are not dependent on the database,
but simply loading C4::Auth requires a valid(ish) koha-conf.xml
and database.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
- wrap in a transaction
- create the patron records needed for the test
To test:
[1] Run prove -v t/db_dependent/Holds.t
[2] Verify that all tests have passed.
[3] Verify that the additional patron records created
by the test no longer exist in the database.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
* C4::Reserves::_FixPriority
- The previous code checked the cancellationdate. If think you never pass
in it with bad parameters, but in order to be sure I added the check on
this value.
- The reservedates array was never used.
* circ/circulation.tt
There was a bug: it was not possible to remove an hold from the
circulation page. Passing reserve_id fixes the issue.
* C4::Reserves::GetReserveId
This subroutine did not have a unit test.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This patch switches from using a combination of
biblionumber/borrowernumber to using reserve_id where possible.
Test Plan:
1) Apply patch
2) Run t/db_dependent/Holds.t
Signed-off-by: Maxime Pelletier <maxime.pelletier@libeo.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Try before the patch:
prove t/db_dependent/Acquisition.t
And after, it should produce:
t/db_dependent/Acquisition.t .. ok
All tests successful.
Files=1, Tests=41, 2 wallclock secs ( 0.03 usr 0.00 sys + 0.42 cusr
0.02 csys = 0.47 CPU)
Result: PASS
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Tests pass and the bookseller is deleted.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Try before the patch:
prove t/db_dependent/Acquisition/OrderFromSubscription.t
And after, it should produce:
t/db_dependent/Acquisition/OrderFromSubscription.t .. ok
All tests successful.
Files=1, Tests=12, 2 wallclock secs ( 0.02 usr 0.00 sys + 0.46 cusr
0.02 csys = 0.50 CPU)
Result: PASS
And some warnings...
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests.
Assumes Dateformat is set to US dates as in the sample data.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Before this patch, the queries in VirtualShelves.t were committed in the
database and have to be removed at the end.
This patch wraps tests in a database transaction.
Test plan:
prove t/db_dependent/VirtualShelves.t
VirtualShelves.t .. ok
All tests successful.
Files=1, Tests=72, 1 wallclock secs ( 0.06 usr 0.00 sys + 0.72 cusr 0.06 csys = 0.84 CPU)
Result: PASS
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Before this patch, the queries in GetOrdersByBiblionumber.t were commited in the database and have to be removed at the end.
This patch wraps tests in a database transaction.
Test Plan :
prove t/db_dependent/Acquisition/GetOrdersByBiblionumber.t
t/db_dependent/Acquisition/GetOrdersByBiblionumber.t .. ok
All tests successful.
Files=1, Tests=3, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.37 cusr 0.05 csys = 0.45 CPU)
Result: PASS
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Since the patron barcode is nullable, and since the tests using
the test patron don't care what the barcode is, don't set it. This
avoids the tests failing if the test database happens to already
have a patron record with the hard-coded barcode that used
to be supplied.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
The DB field aqorders.biblioitemnumber seems to be unused except to get
the itype on the spent.pl page.
This information can be retrieved uising another SQL join.
Test plan:
Try a complete workflow in the acquisition module: create an order,
receive it, play with the syspref AcqCreateItem.
Check that no regression is found and that the data for existing
orders don't change.
Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
To test, in a test database that has the sample branches
loaded, run
prove -v t/db_dependent/Koha_template_plugin_KohaBranchName.t
Note that this includes regression tests for the issues
reported in bug 10494; these won't pass without applying
the patch that fixes them.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Most important: Does no longer delete all shelves!
Checks if there are ten borrowers for testing. But even works without them :)
When creating or modifying lists, takes name clashes into consideration.
Small change to _CheckShelfName in VirtualShelves module. Making it possible to
check a name for a list whose owner has been set to NULL. Note that a test
like field=? with undef for placeholder will not work in MySql.
Test plan:
How do you test a test? Well, you could run it on various databases..
But for real hacking, you could also add some debug lines.
I tested this by forcing 10 undefs in @borrowernumbers.
And by overwriting the return value of randomname with an existing name.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
After applying this patch and the patch submitted in bug 10495, you can
run prove t/db_dependent/HoldsQueue.t and admire that all tests pass.
This patch creates a borrower and uses Koha routines instead of directly
updating the database.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
t/db_dependent/HoldsQueue.t assumed, but did not check,
that the AutomaticItemReturns system preference was off
at the beginning of the test un. This patch makes sure
that that assumption is met.
To test:
[1] Make sure that at least one item is on loan (this is
another assumption that the test case makes, one
that should be corrected with the work proposed
for bug 10336.
[2] Turn the AutomaticItemReturn system preference on.
[3] Run the test:
prove -v t/db_dependent/HoldsQueue.t
[4] Tests 4 and 6 should fail.
[5] Apply the patch.
[6] Run the test case again; this time, all tests should pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
t/db_dependent/needs_user_input/Auth.t and
t/db_dependent/needs_user_input/Auth_with_ldap.t seem not really useful.
If I refer to the git history, it seems that they are antiquated tests.
The first one is not compilable:
perl -wc t/db_dependent/needs_user_input/Auth.t
Can't locate override_context_prefs.pm
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
- Wrap tests in a database transaction; that
way, no special cleanup code is required
- Use AddItem rather than AddItemFromMarc to create
test items; there's no need to build in a
dependence on any particular MARC flavor or
framework in our test cases (except, of course,
for test cases that are explicitly exercising
code that involves the frameworks).
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
prove t/db_dependent/CourseReserves.t
t/db_dependent/CourseReserves.t .. ok
All tests successful.
Files=1, Tests=20, 2 wallclock secs ( 0.02 usr 0.00 sys + 0.43 cusr
0.03 csys = 0.48 CPU)
Result: PASS
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Without correct data, test fails prior to patch, passes no matter what
after patch is applied.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Removes the following exported but unused subs from Overdues.pm:
CreateItemAccountLine
UpdateAccountLines
CheckAccountLineLevelInfo
CheckAccountLineItemInfo
CheckExistantNotifyid
GetNextIdNotify
GetNotifyId
ReplacementCost
ReplacementCost2
GetOverdueDelays
GetOverduerules
Test plan:
It is hard to test the removal of something that was not used :) Try this:
Do a recursive grep on these routine names in the Koha codebase.
Compile some scripts that use the Overdues module.
And just to be sure we do not break something:
Go to Circulation: Do a checkout, checkin, place and confirm a hold.
Go to Patrons: Goto Check out. Goto Fines.
Run the command line scripts: fines.pl and overdue_notices.pl.
Go to opac-user.pl.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Are not used. Contain several FIXMEs.
Removing them makes life easier.
Test plan:
Actually, you cannot test this.
But for confidence: do a Z3950 search in cataloguing and acquisition.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Put the 10 biblionumbers in a list
Add a FIXME for deleting shelves
Do temporary repair on duplicate name test (Followup via report 10386)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Test Plan:
1) Enable IndependantBranches
2) Apply this patch
3) Run updatedatabase.pl
4) Verify that the system preference still functions correctly
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Renamed that routine to GetItemCourseReservesInfo in
order to avoid any potential confusion with reserves
qua hold requests.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
New modules should not export any symbols by default
without a very good reason.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>