Commit graph

270 commits

Author SHA1 Message Date
Galen Charlton
7a729c2b0a test suite: new tests for installer
Added tests of loading the DB initialization and
sampple data SQL scripts for every language
and MARC flavour combination defined in
installer/data/{dbms}.  Errors that the
new test class should catch include:

* SQL syntax errors in kohastructure.sql
* SQL errors in the sample data

For each language and MARC flavour combination,
all mandatory and optional scripts are loaded.

As of this commit, several errors are reported
by this test class; these will be fixed separately.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-11 06:49:20 -05:00
Galen Charlton
339fc5fcab test suite refactoring
Moved routines to clear and create database and manage
zebraqueue_daemon.pl to KohaTest.pm so that they're
available to test classes - needed for installation
and upgrade tests in particular.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-11 06:49:04 -05:00
Andrew Moore
db755a4307 bug 2088: test suite refactoring to deal with t/override_context_prefs.pm
Some minor changes to get the test suite working a bit better:
I removed a superfluous method from t/lib/KohaTest.pm.
I made each barcode for the items added in KohaTest.pm unique so that they would actually get inserted.

Then, I removed t/override_context_prefs.pm. If you need that functionality, you're a database
dependent test and should be a module in t/lib.
So, I deleted all of the trivial .t tests that just 'use'd their modules and had no other
tests and replaced them with lib/KohaTest/*pm modules that do a little bit more checking
on those modules.
I removed the references to override_context_prefs.pm in all of the other .t modules.
They all pass now with no override_context_prefs.pm module.

The database_depenedent.pl test script still does not pass entirely. There's a problem with the zebra index
not being reset each time that the tables are truncated. I'll get to that.

no functional or documentation changes here.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-11 06:48:40 -05:00
Joe Atzberger
f8fecb7863 Wrapper for Koha's use of HTML::Scrubber, with test script on usage.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-11 06:43:46 -05:00
Andrew Moore
26531a6a43 bug 2087: test cases for misc/cronjobs/longoverdue.pl
I'm adding some functional tests that demonstrate that long_overdue.pl does what we think it does.
These tests don't actually work since override_context_prefs.pm gets in the way of C4::Context::preference. I opened up bug 2088 to address that.

There are no functional or documentation changes due to this patch.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-11 06:43:35 -05:00
Galen Charlton
a6dd418260 kohabug 2076: add DB schema creation scripts from past versions
For test cases to be written soon, added kohastructure.sql (or equivalent)
from the following versions:

2.2.9
3.0-alpha
3.0-beta (note that schema for 3.0-beta2 is the same)

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-11 05:40:47 -05:00
Galen Charlton
22aa16e87f kohabug 2076 - remove three tables (DB rev 077)
Removed the categorytable, mediatypetable, and subcategorytable
tables.  These three tables appear to be from an incomplete
patch from pre-git that defined these tables to implement
additional search limits, and are not present in the 2.2.9
package.  In 3.0, these tables did nothing - the only code that
referred to them are incomplete admin editors that lack HTML
templates and are not referred to anywhere.

The updatedatabase.pl logic to remove these tables is conservative;
the tables are dropped only if they exist and are all empty.  Effectively,
this means that they'll be dropped if you've been running a fresh install
of 3.0 from git or the alphas or betas; if you've upgraded your database
from 2.2.9, these tables likely weren't in your database to begin with.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-01 18:59:28 -05:00
Galen Charlton
438ed23337 staging import - enhance record overlay behavior
Enhanced the ability of catalogers to specify how
bib and item records should be added, replaced, or
ignored during a staging import.

When an import batch of bib records is staged and commit,
the user can now explicitly specify what should occur
when an incoming bib record has, or does not have, a match
with a record already in the database.  The options are:

if match found (overlay_action):
  create_new (just add the incoming record)
  replace (replace the matched record with the incoming one)
  use_template (option not implemented)
  ignore (do nothing with the incoming bib; however, the
          items attached to it may still be processed
           based on the item action)

if no match is found (nomatch_action):
  create_new (just add the incoming record)
  ignore (do nothing with the incoming bib; in this
          case, any items attached to it will be
          ignored since there will be nothing to
          attach them to)

The following options for handling items embedded in the
bib record are now available:

  always_add (add the items to the new or replaced bib)
  add_only_if_match (add the items only if the incoming bib
                     matches an existing bib)
  add_only_if_add (add the items only if the incoming bib
                   does *not* match an existing bib)
  ignore (ignore the items entirely)

With these changes, it is now possible to support the following use cases:

[1] A library joining an existing Koha database wishes to add their
    items to existing bib records if they match, but does not want
    to overlay the bib records themselves.
[2] A library wants to load a file of records, but only handle
    the new ones, not ones that are already in the database.
[3] A library wants to load a file of records, but only
    handle the ones that match existing records (e.g., if
    the records are coming back from an authority control vendor).

Documentation changes:

* See description above; also, screenshots of the 'stage MARC records
for import' and 'manage staged MARC records' should be updated.

Test cases:

* Added test cases to exercise staging and committing import batches.

UI changes:

* The pages for staging and managing import batches now have
  controls for setting the overlay action, action if no match,
  and item action separately.
* in the manage import batch tool, user is notified when they
  change overlay action, no-match action, and item action
* HTML for manage import batch tool now uses fieldsets

Database changes (DB rev 076):

* added import_batches.item_action
* added import_batches.nomatch_action
* added 'ignore' as a valid value for import_batches.overlay_action
* added 'ignored' as a valid value for import_records.status
* added 'status' as a valid value for import_items.status

API changes:

* new accessor routines for C4::ImportBatch

    GetImportBatchNoMatchAction
    SetImportBatchNoMatchAction
    GetImportBatchItemAction
    SetImportBatchItemAction

* new internal functions for C4::ImportBatch to
  determine how a given bib and item are to be
  processed, based on overlay_action, nomatch_action,
  and item_action:

    _get_commit_action
    _get_revert_action

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-30 21:58:46 -05:00
Galen Charlton
aad276c3cd test framework - two improvements
[1] When running the database-dependent tests (cd t, make test),
    all tables in the test database are dropped prior to running
    the installer and test cases.  This means that the test
    database will start with a clean slate.
[2] It is now possible to specify a single test class to run,
    to avoid having to run all of them:

    cd t
    make test TEST_CLASS=Search

    To run all DB-dependent tests, just do the usual

    cd t
    make test

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-30 21:58:32 -05:00
Galen Charlton
f7b5af15c4 added reindexing routine to KohaTest
KohaTest->reindex_marc() does a full Zebra reindexing of
bib and authority records and clears zebraqueue.  It is
meant for use in test classes that do a lot of bib, authority,
and/or item record changes that would be slowed down by
waiting for zebraqueue_daemon.

Also adjusted list of tables that are automatically truncated.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-30 21:58:26 -05:00
Andrew Moore
c41da00b4a Bug 2044: allowing multiuple icon sets
I've rearranged the two directories where media type icons live.
I've also added two more collections of icons, one from
http://apps.carleton.edu/campus/library/bridge_icons/
and one from liblime (Tina). The first has a license restriction that I added
to the "Licenses" tab on the "About" page.

Then, I've adjusted the Item Types Administration page so that it can deal
with multiple collections of icons.

I also added a test script to verify that the two identical icon directories
are actually identical.

DOCUMENTATION CHANGE: It's possible that we need to add something to the administration
documentation to indicate how you can add more sets of icons if you want. You simply add
directory to koha-tmpl/intranet-tmpl/prog/img/itemtypeimg/ and to
koha-tmpl/opac-tmpl/prog/itemtypeimg. The icons should start showing up.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-24 11:54:18 -05:00
Andrew Moore
1a6d84c4a6 testing framework: adding more warnings about possible data loss
I'm adding some more warnings in Makefile.PL to indicate that you WILL lose the data
in your testing database.

I've also relaxed the requirement that the teting database have "test" in its name.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-22 09:09:05 -05:00
Andrew Moore
d6f2a2ef9c testing framework: replacing PERL5LIB in order to more conidently find libraries
This patch makes the test suite work even when $PERL5LIB isn't set to the install directory.
It replaces $PERL5LIB with '..' in order to help ensure that we're loading the C4 libraries
out of the installation directory.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-22 08:40:43 -05:00
Galen Charlton
33036c4ae4 test suite - various changes
* All configuration and run-time files created during
  a test suite run now live under t/run
* made sure scripts copied to t/run/bin are executable
* added t/run and t/test-config.txt to .gitignore

Signed-off-by: Andrew Moore <andrew.moore@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-21 11:26:30 -05:00
Galen Charlton
e46bceb305 test suite: removed dep on 'acm' user
Signed-off-by: Andrew Moore <andrew.moore@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-21 11:26:29 -05:00
Andrew Moore
d37e9712eb adding database-dependent test libs.
These test libs should have been included in the previous patch.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-21 11:26:28 -05:00
Andrew Moore
80568463ea improvements to automated tests, including a testing database
I'm adding a bunch of additions to the test suite. There is now a test
database that is created, and a test instance of the zebra server and
daemon that are run before the tests in t/database-dependent.pl are
run. This means that you can test things that insert (or destroy)
things in the database.

To use these tests, after you 'make' your koha installation, you can
change to the 't' directory and 'make test' there.

There is now an additional question asked during installation. It asks
whether you would like to run the data-dependent tests. If so, It asks
you for some login information to a test database. I recommend that
you do not not use your production database here. It will delete all
of the data in it.

Things that need improvement:
* I suspect that there are large parts that are not very platform
  independent, so they will need to be improved.
* There are some parts of the installer that will probably be
  refactored to let this work a little bit better, including being run
  directly from a main-level 'make' target at some point.
* Lots more tests to add. Be bold! (see the t/lib directory)
* other tests in t/*.t can possibly benefit from being included in here.

There are two required perl modules for this part of the test suite. I
use:
'Test::Class' => 0.028,
'Test::Class::Load' => 0.02,
They are not listed as requirements in the top-level Makefile.PL
because they're not actually required to install or use Koha, but if
you want to run the test suite, you can install them from CPAN.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-21 11:26:27 -05:00
Andrew Moore
a5325c4fcc use bind variables in C4::Acquisition::GetPendingOrders
I improved the tests a bit for this module so that they at least skip
if there's not enough data in the database to test with.
I was unable to test the actual execution path through the change I actually made.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-03-19 15:46:23 -05:00
Galen Charlton
60a98d258a IMPORTANT - refactor MARC character set handling
* IsStringUTF8ish - determine if scalar contains a string in UTF8
* MarcToUTF8Record - convert MARC blob or MARC::Record to UTF8
* SetMarcUnicodeFlag - set appropriate MARC21 or UNIMARC field to
  indicate that record is in UTF-8.

Design points of this module include:

* No dependencies on other C4 modules, making it easier to add
  more test cases
* All character conversion code in one place
* Single entry point for doing a character conversion on a
  MARC record
* Capture of errors and warnings produced by Text::Iconv
  and MARC::Charset
* Start of support for guessing the source character set of
  a MARC record.

Several functions were moved from other scripts
or modules to C4::Charset:

* C4::Koha->FixEncoding (expanded and renamed
  MarcToUTF8Record)
* C4::Koha->char_decode5426
* fMARC8ToUTF8 from bulkmarcimport.pl (renamed
  _marc_marc8_to_utf8)

Several batch jobs were adjusted to use MarcToUTF8Record instead of
FixEncoding.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-02-03 07:23:56 -06:00
Joe Atzberger
a82d245fc6 C4::Debug - Centralized debug switches module, test and proof conversion (in Dates.pm)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-23 21:27:20 -06:00
Joe Atzberger
b52e6430fc Dates - remove extra newlines from carps, add partial "00" date tests to Dates.t
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-14 16:45:31 -06:00
Galen Charlton
5290ec5596 test suite cleanup
Many of the tests were failing or putting warnings
because a valid systempreferences table is
usaully absent by the time 'make test' is run.

Fortunately, only a few modules try to invoke
C4::Context->preference during module initialization,
so added to the test suite override_context_prefs.pm,
which replaces preference() with a sub to return
testing values for three variables: 'dateformat',
'marcflavour', and 'LibraryName'.

Also fixed bug in t/Boolean.t

With this patch and the patch to move the DB-dependent
tests off to the side for the moment, 'make test'
now runs cleanly, at least on Debian.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-08 14:08:02 -06:00
Galen Charlton
156cbf4eb6 DB-dependent tests moved
Moved test cases that depend on the DBMS and having
an initialized Koha database to a subdirectory
of t so that they will not be swept up into
the default 'make test'.  Goal is to have
these DB-dependent tests runnable either via
a special make target or perhaps from the
web installer.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-08 14:07:38 -06:00
Galen Charlton
a49b1e07bc t/Date.t - now uses Test::More
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-08 14:07:33 -06:00
Galen Charlton
d7d8e522db removed t/Charset.t
Functions being tested no longer exist

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-08 14:07:31 -06:00
Galen Charlton
1943e17d60 C4::Output tests -- removed inccorect tests
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-08 14:07:23 -06:00
Galen Charlton
809ea60d07 start of test suite for C4::Items
Only functions that do not touch the DB
are currently tested.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-03 16:26:55 -06:00
Joe Atzberger
aa7a90738a Dates.pm - IMPORTANT fix for dmy_array (part of obejct, not class)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-20 19:13:21 -06:00
Joe Atzberger
46ac9d4bfa rename ldap test file
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-13 17:34:14 -06:00
Joe Atzberger
8b54c061ae Auth.t - running this test will fail unless Auth.pm patches get trough.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-04 17:28:23 -06:00
Joe Atzberger
94c4c7c1f7 Auth_with_ldap : module and test final touches.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-04 17:28:21 -06:00
Joe Atzberger
a462c8939e LDAP - further integration
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-04 17:28:19 -06:00
Joe Atzberger
bfcc5b00f9 Dates.pm - ongoing integration, acqui/histsearch.pl
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-04 17:28:17 -06:00
Joe Atzberger
d88ecc0751 Big LDAP changes, module test for Context.pm, still more yet to come.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-04 17:27:06 -06:00
Joe Atzberger
ba0486aad6 LDAP test and example LDIF file.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-16 13:24:45 -06:00
Joe Atzberger
76ea4886c2 Auth_with_ldap.t - real test cases... work in progress
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-16 13:24:44 -06:00
Joe Atzberger
db28108a6b Input.t permissions fix
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-16 13:24:37 -06:00
Chris Cormack
b9c20fa9cf Patch from Galen Charlton, removing $Id$ $Log$ and $Revision$ from files
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-18 20:22:01 -05:00
Joe Atzberger
a1fe32d2f8 Total Test Overhaul! Most of these were stubs, and still are.
Input.t was replaced because it tested a now obsolete function.
Input.pm has that function commented out.
Several files were renamed to match their counterparts or
correct misspellingz.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-18 16:26:44 -05:00
Joe Atzberger
92dbfc6c9f Renamed file to match module. Trivial change.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-18 16:26:25 -05:00
Joe Atzberger
82f3a9423b Dates.pm: perl test to accompany Dates.pm functions.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-17 07:01:06 -05:00
Joe Atzberger
bd76a1fb0f Context.pm fatalsToBrowser now dependent on $ENV{USER_AGENT}.
Minor adjustments to Dates.pm and associated test.  You should be able to run a
perl test that uses Context w/o getting fatalsToBrowser output.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-12 22:19:42 -05:00
Joe Atzberger
cd967a2db1 New object-oriented date module to soon replace Date.pm.
Also included is a traditional perl (t/Dates.t) test script.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-08 15:55:26 -05:00
Chris Cormack
bcf0c513fb Test for C4::Branch
Just skeletal at this stage, actual tests need to be added

Signed-off-by: Chris Cormack <crc@liblime.com>
2007-09-04 03:15:03 -05:00
MJ Ray
a5a419616d Disable tests
Signed-off-by: Chris Cormack <crc@liblime.com>
2007-08-28 16:50:39 -05:00
Joshua Ferraro
6cdf0832e2 new virtual shelves changes, keyed by biblionumber
Signed-off-by: Chris Cormack <crc@liblime.com>
2007-08-09 09:17:49 -05:00
Joshua Ferraro
d5acfe9d73 update to virtual shelves -- approved 2007-08-08 13:12:47 -05:00
Joshua Ferraro
812ba6cd9c working on virtual shelves cleanup, partially finished
Signed-off-by: Chris Cormack <crc@liblime.com>
2007-08-08 11:39:24 -05:00
rangi
289d578bec Adding more tests, it now tests the exported functions 2007-06-24 22:48:50 +00:00
rangi
979f09cdd6 Missed test 2007-06-18 07:28:58 +00:00
rangi
822b040577 Removing tes for deprecated function, of course there are a ton more
functions in here that need tests written for them
2007-06-18 03:26:54 +00:00
rangi
77618f43cf Finishing up the last of the tests 2007-06-18 03:20:19 +00:00
rangi
f30d3c79e3 Continuing on my tests mission 2007-06-18 01:58:24 +00:00
rangi
ccc8db346d More test files 2007-06-18 01:34:50 +00:00
rangi
07b3e3c952 Continuing to add tests 2007-06-18 00:51:10 +00:00
rangi
3e275d1217 Simple compile only test for C4::Amazon
Needs tests written for the 2 functions in it.
2007-06-17 23:44:04 +00:00
rangi
07902f96e8 Working on unit tests 2007-06-17 23:35:36 +00:00
tipaul
f8e9fb6445 rel_3_0 moved to HEAD (introducing new files) 2007-03-09 15:34:17 +00:00
tipaul
86e9db4e67 rel_3_0 moved to HEAD (removing useless file) 2007-03-09 15:22:00 +00:00
acli
6157f1842b Convenience function to check for 1/0/true/false/on/off/yes/no 2003-02-06 06:15:00 +00:00
acli
52a5fd4bbd Moved C4/Charset.pm to C4/Interface/CGI/Output.pm
Create output_html_with_http_headers function to contain the "print $query
->header(-type => guesstype...),..." call. This is in preparation for
non-HTML output (e.g., text/xml) and charset conversion before output in
the future.

Created C4/Interface/CGI/Template.pm to hold convenience functions specific
to the CGI interface using HTML::Template

Modified moremembers.pl to make the "sex" field localizable for languages
where M and F doesn't make sense
2003-02-02 07:18:37 +00:00
acli
ea50c2acb6 Preliminary fix of the CGI.pm problem of always assuming that everything is
in ISO-8859-1.

A new C4::Charset module (tentative name) has been created to guess the
charset of a piece of HTML markup. The CGI programs will be modified to use
this module as they are encountered during translation.
2003-01-19 06:15:44 +00:00
tonnesen
a0df2d5ea3 Added a couple of tests. 2002-10-24 04:12:10 +00:00
tonnesen
d0a060afb5 Added some more functionality to Shelf.pm (including the ability to actually
create a new shelf) and started a test script (Shelf.t)
2002-10-23 23:32:47 +00:00
arensb
cef449e3fa Removed the dependency on Set::Scalar. 2002-10-12 06:08:28 +00:00
tonnesen
04dd31fa07 47 files to go, 47 files to go, take one down, pass it around...
46 files to go.
2002-06-20 18:17:51 +00:00
tonnesen
67a59666c3 Added checking for option to run unsafe database tests. The idea is that tests
that attempt to modify the library database will _not_ be run unless the
environment variable DoUnsafeDBTests is set to 1.  This allows people on
production systems to run the tests without any fear of data corruption, while
developers can run the full suite of tests on a standard sample database.
2002-06-01 05:46:08 +00:00
pate
90a0599814 quick updates/corrections 2002-05-31 22:46:59 +00:00
tonnesen
14d422a951 Skeleton test file for Catalogue.pm. Fails miserably so far. :) 2002-05-31 22:17:12 +00:00
pate
d9adf8154f updated testing 2002-05-31 20:35:54 +00:00