<<

NAME

t::lib::Mocks - A library to mock things for testing

API

Methods

mock_config

    t::lib::Mocks::mock_config( $config_entry, $value );

Mock the configuration $config_entry with the specified $value.

NOTE: We are only mocking config entries here, so no entries from other sections of koha-conf.xml. Bug 33718 fixed the section parameter of mocked Koha::Config->get calls for other sections (not cached).

mock_preference

    t::lib::Mocks::mock_preference( $preference, $value );

Mock the $preference with the specified value.

mock_userenv

    t::lib::Mocks::mock_userenv(
        {
          [ patron         => $patron,
            borrowernumber => $borrowernumber,
            userid         => $userid,
            cardnumber     => $cardnumber,
            firstname      => $firstname,
            surname        => $surname,
            branchcode     => $branchcode,
            branchname     => $branchname,
            flags          => $flags,
            emailaddress   => $emailaddress,
            desk_id        => $desk_id,
            desk_name      => $desk_name,
            register_id    => $register_id,
            register_name  => $register_name, ]
        }
    );

Mock userenv in the context of tests. A patron param is usually expected, but some other session attributes might be passed as well, that will override the patron's.

Also, some sane defaults are set if no parameters are passed.

<<