Bug 25296: Add a way to force an empty Koha::Objects resultset
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 27 Apr 2020 21:33:05 +0000 (18:33 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 29 Apr 2020 18:00:11 +0000 (19:00 +0100)
commitbe67b8c18ed726f0887e36b54a4a13942da0504b
tree08c37d34c381372dfc6d3eddea1feb1fbf8a006b
parentfce7094c297acd57f22b99c06d8ae97af04f5596
Bug 25296: Add a way to force an empty Koha::Objects resultset

This patch adds a new ->empty method to Koha::Objects, that can be used
to make the underlying DBIC resultset empty. This way, we can have
consistency in our method's return values without the need to build
a query that we know in advance that will be empty. No need to hit the
DB at all.

To test:
1. Apply this patches
2. Notice the tests cover what is expected
3. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Objects.t
=> SUCCESS: Tests pass! Yay!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Objects.pm