<<

Expensive test method attribute

If a test method is decorated with an Expensive attribute, it is skipped unless the RUN_EXPENSIVE_TESTS environment variable is defined.

To declare an entire test class and its subclasses expensive, define a SKIP_CLASS with the Expensive attribute:

    sub SKIP_CLASS : Expensive { }

startup methods

these are run once, at the beginning of the whole test suite

startup_20_add_bookseller

we need a bookseller for many of the tests, so let's insert one. Feel free to use this one, or insert your own.

startup_22_add_bookfund

we need a bookfund for many of the tests. This currently uses one that is in the skeleton database. free to use this one, or insert your own.

sub startup_22_add_bookfund : Test(startup => 2) { my $self = shift;

    my $bookfundid = 'GEN';
    my $bookfund = GetBookFund( $bookfundid, undef );
    # diag( Data::Dumper->Dump( [ $bookfund ], qw( bookfund  ) ) );
    is( $bookfund->{'bookfundid'},   $bookfundid,      "found bookfund: '$bookfundid'" );
    is( $bookfund->{'bookfundname'}, 'General Stacks', "found bookfund: '$bookfundid'" );

    $self->{'bookfundid'} = $bookfundid;
    return;
}

startup_24_add_branch

startup_24_add_member

Add a patron/member for the tests to use

startup_30_login

setup methods

setup methods are run before every test method

teardown methods

teardown methods are many time, once at the end of each test method.

shutdown methods

shutdown methods are run once, at the end of the test suite

utility methods

These are not test methods, but they're handy

random_string

Nice for generating names and such. It's not actually random, more like arbitrary.

random_phone

generates a random phone number. Currently, it's not actually random. It's an unusable US phone number

random_email

generates a random email address. They're all in the unusable 'example.com' domain that is designed for this purpose.

random_ip

returns an IP address suitable for testing purposes.

random_date

returns a somewhat random date in the iso (yyyy-mm-dd) format.

tomorrow

returns tomorrow's date as YYYY-MM-DD.

yesterday

returns yesterday's date as YYYY-MM-DD.

days_from_now

returns an arbitrary date based on today in YYYY-MM-DD format.

add_biblios

  $self->add_biblios( count     => 10,
                      add_items => 1, );

  named parameters:
     count: number of biblios to add
     add_items: should you add items for each one?

  returns:
    I don't know yet.

  side effects:
    adds the biblionumbers to the $self->{'biblios'} listref

  Notes:
    Should I allow you to pass in biblio information, like title?
    Since this method is in the KohaTest class, all tests in it will be ignored, unless you call this from your own namespace.
    This runs 10 tests, plus 4 for each "count", plus 3 more for each item added.

reindex_marc

Do a fast reindexing of all of the bib and authority records and mark all zebraqueue entries done.

Useful for test routines that need to do a lot of indexing without having to wait for zebraqueue.

In NoZebra model, this only marks zebraqueue done - the records should already be indexed.

clear_test_database

  removes all tables from test database so that install starts with a clean slate

create_test_database

  sets up the test database.

start_zebrasrv

  This method deletes and reinitializes the zebra database directory,
  and then spans off a zebra server.

stop_zebrasrv

  using the PID file for the zebra server, send it a TERM signal with
  "kill". We can't tell if the process actually dies or not.

start_zebraqueue_daemon

  kick off a zebraqueue_daemon.pl process.

stop_zebraqueue_daemon

<<