[Koha-bugs] [Bug 25296] Add a way to force an empty Koha::Objects resultset

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Apr 29 14:31:44 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25296

--- Comment #13 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Created attachment 103929
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=103929&action=edit
Bug 25296: Make ->empty work for uninstantiated calls

In OO we would usually instantiate the class and then interact with it
like in:
    my $rs = Koha::Patrons->new;
    $rs->empty;

Koha's practice is to call things like Koha::Patrons->search without
instantiating the Koha::Patrons class. To keep consistency, this patch
instantiates the resultset object on behalf of the caller if required.

To test:
1. Apply the tests patch
2. Run:
   $ kshell
  $k prove t/db_dependent/Koha/Objects.t
=> FAIL: Tests fail because it is expected to have the class
instantiated
3. Apply this patch
4. Repeat 2.
=> SUCCESS: Tests pass, instantiation happens implicitly.
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen at theke.io>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list