Commit graph

1113 commits

Author SHA1 Message Date
Emmanuele Somma
2e368c1478 Bug 13264: Additional test for search in intranet calatogue
The utf-8 test do: insert a biblio record with tool, search the record in intranet,
delete batch upload and biblio records.

To test: prove intranet_search_utf8.t

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
Zeno Tajoli
20a7f1d038 Bug 13264: Follow up: in opac_utf8.t insert also delete of biblio
In previous version of the test opac_utf8.t clears import from resevoir
but it doesn't delete record from biblio table in MySQL.
This the standard work of the feature, see:
http://manual.koha-community.org/3.18/en/catalogtools.html#managestaged

Now the script deletes also record on MySQL level.
No necessary on Zebra level because it uses a temporaney Zebra index that it is
clenaned at the end of the script.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
5e43f20a44 Bug 13264: Make opac_utf8.t launch its own helper processes
This patch makes opac_utf8.t launch its own:
- zebrasrv process
- rebuild_zebra.pl (daemon mode)

It also takes care of killing them when finished. It sets a frecquency
of 5 seconds for the indexer, and waits 10 just in case before looking
for the indexed records.

To test:
- Just launch the tests.

Edit: fixes on the license text.

Regards
Tomas

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:26 -03:00
0f44011336 Bug 13264: no need to test for MySQL
This patch removes the test for a running MySQL process.
It is already implied by successfuly loading C4::Context.

It also fixes the license text.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:25 -03:00
Zeno Tajoli
44ed6c37c5 Bug 13264: Test for utf-8 on authorised values input/display/delete
This test check utf-8 support on web intranet interface for authorized values.
It test input, search and delete of utf-8 values.
If all OK it destroy values inserted

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:25 -03:00
Zeno Tajoli
fb9eb5737b Bug 13264: Test for utf-8 on Opac search
This test need to setup zebraserver and background indexing.
You need to set also KOHA_INTRANET_URL and KOHA_OPAC_URL
in the user enviroment.

It imports sample records and retrieves them on hte OPAC through
Apache.

To run it: prove opac_utf8.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:25 -03:00
Zeno Tajoli
1ded4bfc55 Bug 13264: UNIMARC and MARC21 records to test UTF-8
The records shares enough chars to do the same search ('deuteros') to
find them and check the same utf-8 chars.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2015-01-13 12:43:25 -03:00
Mark Tompsett
e6dbae9dbf Bug 12868: Improving t/db_dependent/Member.t
The mock function of GetMemberAccountRecord did not properly
account for the undef case. This was corrected.

Then all 4 combinations of borrower number and card number being
defined or not were called to GetMemberDetail.

The problematic test case is where the borrower number is
undefined and the cardnumber is defined.

TEST PLAN
---------
1) Apply just this first patch.
2) prove -v t/db_dependent/Member.t
   -- This should fail!
3) Run koha QA test tools.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-10 16:16:51 -03:00
Jonathan Druart
fbfc109777 Bug 13378: Add a filter to search suggestions not linked to a fund
This patch adds a "None" option for the fund filter.

Test plan:
1/ Go on the suggestion search page
2/ Search suggestions not linked to a fund using the "None" option.
3/ Search all suggestions (linked or not to a fund) using the "Any" option.

Works as expected.
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-10 16:13:08 -03:00
Jonathan Druart
1c9275d5c5 Bug 12969: Fix typo
rrpgsti should be rrpgste

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-04 12:45:31 -03:00
Jonathan Druart
a19958ee2c Bug 12969: Add a subroutine to calculate VAT and prices
This patch adds a new subroutine populate_order_with_prices in the
C4::Acquisition module.

Its goal is to refactore the VAT and prices calculation into Koha.
All scripts will use this subroutine.

Test plan:
Verify that the prices in t/Prices.t are consistent with the values
listed in the file "Prices and VAT calculation - before" submit on bug
12964.
Verify that
  prove t/Prices.t
returns green

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-04 12:45:18 -03:00
d8eff67534 Bug 13496: add a method for the templates to print Koha version as desired
This patch introduces a simple template plugin function that returns
the Koha version number in different suitable formats.

It introduces unit tests for the new function. They are run with

To test:
- Apply the patch
- Run
  $ prove t/Koha_Template_Plugin_Koha.t
=> SUCCESS: the tests pass.
- Sign off :-D

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>
2015-01-04 11:24:07 -03:00
3e5ea11452 Bug 13167: (QA followup) regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-04 11:14:58 -03:00
e8f5312dc7 Bug 12896: (QA followup) use C4::Bookseller in t/db_dependent/Serials/Claims.t
As C4::Bookseller is no longer imported in C4::Acquisition the tests
fail because of an undefined function call.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-04 10:54:46 -03:00
Jonathan Druart
a93fd3fe06 Bug 12896: Remove 2 occurrences in comments
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Passes tests and QA script.
Full test report on the bug report.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-31 14:16:05 -03:00
Jonathan Druart
469f36d38f Bug 12896: Move the bookseller-related code into Koha::Acquisition::Bookseller
The C4::Acquisition module should be exploded in order to add
readability and maintainability to this part of the code.

This patch is a POC, it introduces a new Koha::Acquisition::Bookseller module and put in
it the code from GetBookSeller and GetBookSellerFromId.

Test plan:
1/ Create a bookseller, modify it.
2/ Add contacts for this bookseller
3/ Create an order, receive it, transfer it
4/ Launch the prove command on all unit tests modified by this patch and
verify that all pass.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-31 14:15:58 -03:00
Jonathan Druart
a43e6d26f6 Bug 13502: Add tests to highlight the problem
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-31 14:07:08 -03:00
Jonathan Druart
fb706f58b2 Bug 1861: Add 1 test to AddMember
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-31 12:14:03 -03:00
Mark Tompsett
7aec3a9aa4 Bug 13453: Koha.t daily quote tests assume sample data
By adding quotes 3 and 25 from the sample data, this test can
pass without having the sample quote data loaded.

TEST PLAN
---------
1) Ensure there is no quote id=3 or that it is NOT
   Abraham Lincoln.
2) prove t/db_dependent/Koha.t
   -- this should fail the daily quote test.
3) apply patch
4) prove t/db_dependent/Koha.t
   -- this should *NOT* fail the daily quote test.
5) run koha qa test tools

Followed test plan 1)-4). Without patch, daily quote test failed. With patch, test passed OK.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described, leaves actual data unchanged.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-28 19:52:51 -03:00
7135364dd2 Bug 1861 [QA Followup] - Fix Check_Userid and unit tests
Check_Userid assumes that a borrowernumber will always be passed in
and thus fails to to return 0 for an already used userid when creating
a new patron.

Unit tests must now also me modified to no longer assume it is possible
to create multiple patrons with the same userid.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-28 19:50:49 -03:00
Mark Tompsett
9412b90599 Bug 13456: Serials/Claims.t expects no subscriptions
However, this is an unreasonable assumption for a system which
is in use (either lots of testing or production).

TEST PLAN
---------
1) Have a supplier with a late subscription.
2) prove t/db_dependent/Serials/Claims.t
   -- will fail
3) apply patch
4) prove t/db_dependent/Serials/Claims.t
   -- success
5) run koha qa test tools

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-19 17:32:28 -03:00
Mark Tompsett
d37dee3ddf Bug 13451: Holidays.t assumes default data
This patch removes that assumption by expressly setting data
to be default.

TEST PLAN
---------
1) Ensure that branch code is NOT 'MPL' in the
   repeatable_holidays table in your database.
2) Ensure that branch codes 'MPL' and 'CPL' do not exist
   in the branches table in your database.
3) prove t/db_dependent/Holidays.t
   -- this should bomb horribly.
4) Apply patch
5) prove t/db_dependent/Holidays.t
   -- all tests should succeed.
6) run koha qa tests

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass without holidays in the calendar.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-17 19:24:50 -03:00
Jonathan Druart
46e3f8169c Bug 12980: GetHistory does useless processing
GetHistory iterated on the orders to calculate the quantity and price.
These values are never used by the called.
It can be removed.

Test plan:
Verify there is no regression on acqui/histsearch.pl and
catalogue/detail.pl
Actually you just have to check that the total quantity and price are
not displayed on these views.

QA: note that 'count' and 'toggle' are never used in the template.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-03 11:42:48 -03:00
22d3ebdb27 Bug 12831: (RM followup) regression test
checkpw_ldap should return 0 if it is not an anonymous bind, and authentication
fails. This is better explained on the bug comments. This is just a regression
test for the revised functionality.

To test:
- Run
  $ prove t/db_dependent/Auth_with_ldap.t
=> FAIL: it fails because C4::Auth_with_ldap doesn't match the expected behaviour
- Apply the bugfix from Martin
- Run
  $ prove t/db_dependent/Auth_with_ldap.t
=> SUCCESS: tests now pass.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-27 14:45:11 -03:00
Jonathan Druart
3b6b8a4a1e Bug 13215: Fix GetLetterTemplates should return default templates if branchcode is not defined
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-27 11:42:26 -03:00
Jonathan Druart
6f599652b1 Bug 13215: The same letter code can be used for several libraries
This patch fixes a major issue introduced by the
commit 5c4fdcf Bug 11742: A letter code should be unique.

The interface should let the possibility to create a default template
letter and some specific ones, with the same letter code (letter.code).

The patches submitted on bug 11742 tried to fix an issue based on a
(very bad) assumption: letter.code should be considered as a primary key and
should be uniq.

This patch reintroduces this behavior.
Note that the interface will block a letter code used in different
module (this is consistent not to have the same letter code used for different
needs).

This patch is absolutely not perfect, it just tries to change as less
change as possible and to use new tested subroutines.

Test plan:
1/ Verify that the problem raised on bug 11742 does not appears anymore.
2/ Verify there are no regression on adding, editing, copying, deleting
letters.
3/ Verify you are allowed to create a default letter template with a letter
code and to reuse for a specific letter (i.e. for a given library).

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-27 11:42:14 -03:00
Jonathan Druart
b141e6d42a Bug 13332: Fix conflict between 5304 and 10860
These 2 bugs are in conflict.
The first one always join the issue table, the second one join on this
table too if the OnSiteCheckouts pref is enable.
So DBI raises an error if the pref is enabled (2 joins on the same
table).

This patch removes the conditional join.

Test plan:
Go on a detail record page with items and verify that items are list and
that the error no more appears in the log file.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Reproduced the problem, the patch fixes it, no noticeable regression found.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, items are visible again.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-26 11:25:04 -03:00
Jonathan Druart
f63aaf2242 Bug 13242: Remove warning if no parameter given
Without any parameter, dt_from_string should not raise a warning
message.

Test plan:
Verify that the test file t/DateUtils.t displays a warning:

  Use of uninitialized value $date_string in pattern match (m//) at
  Koha/DateUtils.pm line 58

if the change in dt_from_string is not applied (manually edit the file).

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-26 11:17:08 -03:00
9a386c7cdb Bug 12851: (QA followup) tests should not expect the <order> tag
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-25 16:05:24 -03:00
4c1ae53d86 Bug 13297 - Shelving location PROC does not work according to manual
According to the manual, "Items will stay in the PROC location until
they are checked in".

This is not the actual behavior. Right now items will only change from
PROC to CART, and that is only if InProcessingToShelvingCart is enabled.
Some libraries want to use the PROC to permanent location feature,
without using the CART.

Additionally, the location is only removed if using returns.pl, but
that is not what the manual says either. What if the library uses
SIP2 devices for handling returns? This should be taken into
account.

Test Plan:
1) Apply this patch
2) Set an item's current location to PROC, and it's permananet location
   to a different location.
3) Check the item in any way you wish
4) Note the shelving location is updated to the permanent location
5) prove t/db_dependent/Circulation/Returns.t

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

I tested this with items which had items.location set to 'PROC' and
items.permanent_location set to NULL, '', and a real value, and it
worked correctly in all cases. I tested with check-ins from returns.pl
and from the table of checkouts in circulation and the PROC location was
correctly removed in both cases.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-23 10:11:28 -03:00
Srdjan
c6b7275bfe Bug 5304: Use branch codes from the database rather than hardcoded CPL and MPL
http://bugs.koha-community.org/show_bug.cgi?id=5304
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No commit message
No test plan.

prove t/db_dependent/Items.t pass
No koha-qa errors

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-21 20:44:53 -03:00
5b71f3c5cd Bug 13281: t/ImportBatch.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:53:36 -03:00
0f92fbbb0c Bug 13279: t/Breeding.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:39:53 -03:00
7fdd7f560b Bug 13280: t/Circulation_barcodedecode.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:38:28 -03:00
e00cbe8091 Bug 13282: t/Message.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:38:02 -03:00
6c2cb7cec8 Bug 13283: t/Overdues.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:37:39 -03:00
1cec3e82dc Bug 13284: t/RotatingCollections.t shouldn't depend on the DB
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-20 09:37:20 -03:00
95ce6945d8 Bug 13277: (QA followup) use t::lib::Mocks
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 18:12:03 -03:00
98fcda28ff Bug 13277: t/SuggestionEngine_AuthorityFile.t shouldn't depend on the DB
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/SuggestionEngine_AuthorityFile.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/SuggestionEngine_AuthorityFile.t
=> SUCCESS: tests pass because the ycan be loaded regardless of
            the absence of the DB server
- Sign off :-D

Regards

Signed-off-by: Magnus Enger <digitalutvikling@gmail.com>
Turned off MySQL and ran the tests before and after the patch.
Works as advertized.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 18:12:00 -03:00
b8a0eefc23 Bug 13278: (QA followup) use t::lib::Mocks
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 18:11:58 -03:00
48da54977a Bug 13278: t/Search.t shouldn't depend on the DB
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/Search.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/Search.t
=> SUCCESS: tests pass because the ycan be loaded regardless of
            the absence of the DB server
- Sign off :-D

Regards

Signed-off-by: Magnus Enger <digitalutvikling@gmail.com>
Turned off MySQL and ran the tests before and after the patch.
Works as advertised.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 18:11:54 -03:00
Katrin Fischer
bb186e09a6 Bug 13223: [QA Follow-up] Adding some unit tests for wrapper
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Trivially amended. Thanks, Katrin.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 13:28:28 -03:00
e2a169dc9d Bug 13242: Add a UT to t/DateUtils.t for testing DateTime bug
A bug in DateTime slow down drastically date parsing when the dates are in the
far distant future:

https://metacpan.org/pod/DateTime#Determining-the-Local-Time-Zone-Can-Be-Slow

This UT tests this situation which affects Koha::DateUtils function
dt_from_string() and output_pref().

TO TEST:
- Apply the patch containing the UT
- prove -v t/DateUtils.t
- You see that parsing a 9999-01-01 that take forever (ie more than 1s)
- Apply the patch containing the fix
- prove -v t/DateUtils.t
- No more complain.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described - check-ins are now much faster.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 11:32:32 -03:00
Jonathan Druart
752c8bf043 Bug 13276: use t::lib::Mocks::mock_dbh
To use this patch, patch from bug 13274 should be applied too.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 11:30:45 -03:00
206157beb1 Bug 13276: t/XSLT.t shouldn't depend on the DB
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/XSLT.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/XSLT.t
=> SUCCESS: tests pass because the ycan be loaded regardless of
            the absence of the DB server
- Sign off :-D

Regards

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass without db connection for me now.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 11:30:41 -03:00
Jonathan Druart
428a744843 Bug 13274: Mock new_dbh in t::lib::Mocks
This patch suggests to create a routine to mock C4::Context::_new_dbh.

NOTE: Works the same with and without this secondary patch.
      koha-qa tests fine. Less cutting and pasting in the future.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 09:50:32 -03:00
340e23ece5 Bug 13274: t/00-load.t shouldn't depend on the DB
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/00-load.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/00-load.t
=> SUCCESS: tests pass because the ycan be loaded regardless of
            the absence of the DB server
- Sign off :-D

NOTE: Even seems to grab more than expected, which is good.
      349 tests in master vs 364 in this branch = 16,
      but removed block is only 13 (lines 20-32).
      Also ran koha-qa test tool. :)

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described, tests passing now without database available.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 09:50:27 -03:00
348bca3dbb Bug 11401: (followup) make tests run on absent deps
The current code breaks if a dependency is missing. The evals are
rearranged so there's no error on missing dependency.

To reproduce:
- Have a dependency for t/NorwegianPatronDB.t removed
- Run
  $ prove t/NorwegianPatronDB.t
=> FAIL: You see an error similar to this (may vary depending on the lib you removed):

t/NorwegianPatronDB.t .. You tried to plan twice at t/NorwegianPatronDB.t line 37.

- Apply the patch
- Run
  $ prove t/NorwegianPatronDB.t
=> SUCCESS: Tests are skipped on missing lib

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 15:32:25 -03:00
Jonathan Druart
b969aa3fa3 Bug 11413: Fix field_numbers
This fix is a global fix for the MarcModificationTemplate feature.
Some unit tests were missing and some behaviors were wrong.
For instance, if you tried to update a non existent field, the script
crashed.

The following line was completely stupid:
    if $from_field ne $to_subfield

The field_number equals 1 if the user wants to update the first field
and 0 for all fields.

The field_numbers (note the s) variable contains the field numbers to
update. This array is filled if a condition exists (field exists or
field equals).

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 12:05:47 -03:00
Jonathan Druart
f76b5c8141 Bug 11413: Fix return for ModifyRecordWithTemplate
Make sure the ModifyRecordWithTemplate routine returns undef.

This patch also removes a warning if GetModificationTemplates is called
without parameter.

Verify
  prove t/db_dependent/MarcModificationTemplates.t
returns green.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 12:05:46 -03:00