Commit graph

582 commits

Author SHA1 Message Date
d46657f8af Bug 10628: make sure AutomaticItemReturn doesn't prevent holds queue from filling local holds with local items
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>
2013-08-20 15:31:38 +00:00
Galen Charlton
40aa42f31f Bug 10653: (follow-up) minor tweaks to RotatingCollections tests
- remove unnecessary module import
- use parentheses for all C4 function calls

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-16 16:09:13 +00:00
Kenza Zaki
12061f44be Bug 10653: add unit tests for C4::RotatingCollections.pm
The tests are wrap in a database transaction.

Test plan:
prove t/db_dependent/RotatingCollections.t
t/db_dependent/RotatingCollections.t .. ok
All tests successful.
Files=1, Tests=41, 20 wallclock secs ( 0.02 usr  0.01 sys +  0.41 cusr  0.02 csys =  0.46 CPU)
Result: PASS

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-16 16:09:00 +00:00
Galen Charlton
572d46e639 bug 5825: (follow-up) add regression test
To test:

Verify that prove -v t/db_dependent/HoldsQueue.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-16 15:35:58 +00:00
Jonathan Druart
1c8efaf3f9 Bug 10481: Unit tests for C4::Members::AddEnrolmentFeeIfNeeded
prove t/db_dependent/Members/AddEnrolmentFeeIfNeeded.t
t/db_dependent/Members/AddEnrolmentFeeIfNeeded.t .. ok
All tests successful.
Files=1, Tests=3,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.38 cusr
0.01 csys =  0.41 CPU)
Result: PASS

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-16 15:08:41 +00:00
Galen Charlton
c6f903198c Bug 10666: (follow-up) really fix the daily quotes test
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>
2013-08-16 00:37:23 +00:00
Galen Charlton
51b8deb4d5 Bug 10663: (follow-up) set circ policy for circulation tests
This patch ensures that the loan rules are set to a known
value suitable for testing.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-15 22:27:55 +00:00
Katrin Fischer
b15b3be5ae Bug 10663: Follow-up - Unit tests for CanBookBeRenewed
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>
2013-08-15 22:27:55 +00:00
dc469424c8 Bug 10663: tests for CanBookBeRenewed
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>
2013-08-15 22:27:40 +00:00
Galen Charlton
a36b3ad43a Bug 7785: (follow-up) standardize POD
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>
2013-08-13 16:15:30 +00:00
Mark Tompsett
07716ca15b Bug 7785: remove MySQL-specific syntax from C4::Members::columns()
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>
2013-08-13 16:14:35 +00:00
Galen Charlton
8f933bc040 Bug 10644: (follow-up) remove inadvertant dependence on Perl 5.14
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>
2013-08-09 18:53:20 +00:00
Galen Charlton
23e302071e bug 2394: regression test for canreservefromotherbranches
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>
2013-08-09 17:44:17 +00:00
Jonathan Druart
9509062072 Bug 10298: Adapt existing code
set_solr and set_zebra is not really useful. It is preferable to use
mock_preference directly.

To test:
1/ Launch Solr
2/ prove -r t/searchengine/
It should produce:
% prove -r t/searchengine/
t/searchengine/000_conn/conn.t ........... ok
t/searchengine/001_search/search_base.t .. ok
t/searchengine/002_index/index_base.t .... IndexRecord called with biblio 2
Indexing biblio 2
t/searchengine/002_index/index_base.t .... ok
t/searchengine/003_query/buildquery.t .... ok
t/searchengine/004_config/load_config.t .. ok
All tests successful.
Files=5, Tests=21,  4 wallclock secs ( 0.03 usr  0.01 sys +  2.74 cusr
0.20 csys =  2.98 CPU)
Result: PASS

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Had to get Solr going again to test this, man .. they could make that
easier

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-09 16:36:17 +00:00
Jonathan Druart
a765d5f88e Bug 10298: Followup: Adapt existing code
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>
2013-08-09 16:35:43 +00:00
Jonathan Druart
eb90241c79 Bug 10298: Mock C4::Context->preference
t::lib::Mocks::Context tried to deal with preferences but did not manage
to.

This patch removes this module and add 2 routines in t::lib::Mocks in
order to mock C4::context->preference and C4::Context->config.

To test:

===START t/test.pl===

use Modern::Perl;
use t::lib::Mocks;
use C4::Context;

say "initial value for version: " . C4::Context->preference('Version');
say "initial value for language: " . C4::Context->preference('language');
t::lib::Mocks::mock_preference('Version', "new version for testing");
say "version is mocked with: " . C4::Context->preference('Version');
say "language is not yet mocked: " . C4::Context->preference('language');
t::lib::Mocks::mock_preference('language', 'new langage for testing');
t::lib::Mocks::mock_preference('Version', 'another version for testing');
say "version is mocked with another value: " . C4::Context->preference('Version');
say "language is finally mocked: " . C4::Context->preference('language');
===END===

Try to execute this file and check that the output is consistent.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-09 16:34:50 +00:00
Fridolyn SOMERS
b874f7d638 Bug 10666: avoid random failures of Daily quotes tests
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>
2013-08-02 20:42:53 +00:00
Galen Charlton
d9d8a8424d Bug 10644: fix typos in test descriptions
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-01 15:09:39 +00:00
Kenza Zaki
5de06b87e2 Bug 10644: add unit tests for ClassSource.pm
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>
2013-08-01 15:09:31 +00:00
Galen Charlton
18454bbb7d move Auth_ParseSearchHistoryCookie.t to db_dependent directory
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>
2013-07-28 19:42:51 +00:00
Galen Charlton
961617765e do some validation of the KohaOpacRecentSearches cookie
Add validation of the value of the KohaOpacRecentSearches.  In
particular, this patch avoids the generation of an internal server
error when the OPAC is presented with an old cookie that uses the
old Storable-based serialization.

This patch also moves parsing of the cookie value into a
new routine in C4::Auth, ParseSearchHistoryCookie, and adds
a test case.

To test (in conjunction with the previous patch):

Exercise the OPAC search history functionality, after
turning on the EnableOpacSearchHistory syspref:

- As an anonymous user, conduct a variety of searches,
  including ones that include non-ASCII characters
- Check the search history and verify that all searches
  are listed
- Apply this patch and the previous one.
- Do *not* clear the KohaOpacRecentSearches cookie
- Check the search history and verify that no searches
  are listed any more
- As an anonymous user, conduct a variety of searches,
  including ones that include non-ASCII characters
- Check the search history and verify that all searches
  are listed
- Log into the OPAC
- Verify that current and past searches are listed in
  search history.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-28 02:52:13 +00:00
Galen Charlton
8d9e6f3710 Bug 9394: (follow-up) modernize test cases
- 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>
2013-07-24 05:04:56 +00:00
Jonathan Druart
dd2185981d Bug 9394: QA Followup
* 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>
2013-07-24 05:04:56 +00:00
53fbfa2dde Bug 9394: Use reserve_id where possible
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>
2013-07-24 05:04:55 +00:00
Jared Camins-Esakov
56ea0f7e0f Bug 9755 QA follow-up: move MARC-specific functionality to utility class
This follow-up moves all the MARC-specific functionality of Koha::Record
(now renamed to Koha::MetadataRecord) to a Koha::Util::MARC utility class.

To test, run relevant unit tests:
> prove t/Koha_MetadataRecord.t t/Koha_Util_MARC.t t/db_dependent/Koha_Authority.t
and optionally try to merge a record.

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-23 23:10:21 +00:00
Jared Camins-Esakov
50fb4612ed Bug 9755: Refactor record merge functionality
This patch refactors the merge record interface and code a little bit
in preparation for making it possible to merge authority records.

To test:
1) Apply patch.
2) Try merging two records:
    a) Create a list.
    b) Add two records you would like to (or be willing to) merge
       to said list.
    c) View said list.
    d) Check the checkboxes next to the two records you added.
    e) Click "Merge selected records."
    f) Choose a merge reference.
    g) Choose fields from each record that you want to keep.
    h) Click "Merge."
3) Confirm that your merged record has the fields and subfields you
   wanted.
4) Run the unit tests for the two files that were changed:
    prove t/Koha_Record.t t/db_dependent/Koha_Authority.t
5) Sign off.

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-23 23:10:07 +00:00
Galen Charlton
5aeefa25ac Bug 10515: add regression tests
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-17 17:27:36 +00:00
Galen Charlton
41baeafda9 bug 10556: regression test for setting deliverytime when adding vendor
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-16 14:55:09 +00:00
Jonathan Druart
eab1812b7d Bug 10274: Execute sql queries into a transaction
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests pass.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-16 14:28:41 +00:00
Jonathan Druart
f72e78f2bd Bug 10274: UT: Acquisition.t needs to create its own data
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>
2013-07-16 14:28:41 +00:00
Jonathan Druart
4f09ebfc8a Bug 10275: Use a transaction for OrderFromSubscription.t
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-16 14:20:38 +00:00
Jonathan Druart
8e44295524 Bug 10275: UT: OrderFromSubscription.t needs to create its own data
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>
2013-07-16 14:20:37 +00:00
Kenza Zaki
d2a7561288 Bug 10499: VirtualShelves.t - wrap tests in a database transaction
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>
2013-07-16 14:17:27 +00:00
Kenza Zaki
45fafb31ce Bug 10575 : GetOrdersByBiblionumber.t needs a database transaction
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>
2013-07-15 16:20:53 +00:00
Jason Etheridge
bce45b4bf5 Bug 9770: test case for sorting of Dewey call numbers that contain prefixes
This adds a test for C4::ClassSortRoutine::Dewey to check that the
call number "JR DVD 800.1" sorts before "JR DVD 900"

To test:

[1] Apply just this patch.
[1] Run prove -v t/ClassSortRoutine_Dewey.t
[2] Test #7 should fail.

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes test plan and QA script.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-15 16:12:47 +00:00
Galen Charlton
e2bb7af216 Bug 10560: add regression test
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-12 14:57:11 +00:00
Galen Charlton
7957dd2a06 Bug 10289: (follow-up) don't set cardnumber for test patron
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>
2013-07-08 14:29:32 +00:00
Galen Charlton
47cf3ec24d Bug 10289: (follow-up) wrap tests in transaction
Applying new standard method for handling tear-down
of test data.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-08 14:27:14 +00:00
Jonathan Druart
6e6c7608b7 Bug 10289: UT: Reserves.t needs to create its own data
Try before the patch:
prove t/db_dependent/Reserves.t

And after, it should produce:
  t/db_dependent/Reserves.t .. 1/4 #
  # Creating biblio instance for testing.
  # Creating item instance for testing.
  # Deleting item testing instance.
  # Deleting biblio testing instance.
  # Deleting borrower.
  t/db_dependent/Reserves.t .. ok
  All tests successful.
  Files=1, Tests=4,  1 wallclock secs ( 0.02 usr  0.01 sys +  0.39 cusr  0.02 csys =  0.44 CPU)
  Result: PASS

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>
2013-07-08 14:23:16 +00:00
Galen Charlton
37b3ac65e1 Bug 10390: (follow-up) correct description of a test
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-05 17:01:28 +00:00
Jared Camins-Esakov
d02e2789e5 Bug 10390: Add ability to delete empty invoices
There is currently no way to delete unused invoices (for example,
invoices created by mistake), and there really should be, since errors
and absent-mindedness can result in numerous empty invoices over the
course of years.

To test:
1) Apply patch.
2) Create three invoices in the Acquisitions module. For one of them,
   receive at least one item. For the other two, do not receive any
   items.
3) View one of the invoices that does not have any items on it.
4) Try to delete it. This should succeed.
5) View the invoice that has an item. There should not be any option
   to delete it.
6) Do an invoice search that brings up the other invoice with no items
   on it. Try to delete it from the results page. This should succeed.
7) Run the unit test:
   > prove t/Acquisition/Invoice.t
8) Sign off.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass. I also did another test:

I cancelled all receipts from an existing invoice and then could
successfully delete it in the last step.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-05 16:51:18 +00:00
Galen Charlton
58ccb8342b Bug 9987: remove reference to biblioitemnumber from test case
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-02 22:04:03 -07:00
Jonathan Druart
da0337b374 Bug 9987: Remove DB field aqorders.biblioitemnunmber
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>
2013-07-02 15:18:50 -07:00
Galen Charlton
96320a786b Bug 10494: test cases for the KohaBranchName plugin
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>
2013-06-30 18:44:57 -07:00
93e87ca0b6 Bug 10386: improvements to VirtualShelves.t
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>
2013-06-28 05:19:49 -07:00
Jonathan Druart
bfbc646fdd Bug 10336: HoldsQueue.t needs to create its own data
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>
2013-06-27 08:23:24 -07:00
Galen Charlton
4e51ec5aae bug 10495: set precondition for HoldsQueue test
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>
2013-06-27 08:23:01 -07:00
Jonathan Druart
b46f0238f2 Bug 10334: remove t/db_dependent/needs_user_input/* tests
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>
2013-06-21 07:33:41 -07:00
Galen Charlton
8743f5aab5 Bug 10332: further improvements to course reserves tests
- 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>
2013-06-18 16:40:43 -07:00
Jonathan Druart
d157179618 Bug 10332: Data could exist in the courses table.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-06-18 16:40:42 -07:00