]> git.koha-community.org Git - koha.git/commit
Bug 18182: Make TestBuilder capable of returning Koha::Object
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 28 Feb 2017 12:08:38 +0000 (09:08 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 21 Apr 2017 00:10:49 +0000 (00:10 +0000)
commite2d14666d9762a6742a326b67f4296f6269c4d4c
tree9d70aa1aa85e58fb8c8a117944ee3cbd1828cd9c
parent6527b3b67506db0289997eb9bb98647fa1967a55
Bug 18182: Make TestBuilder capable of returning Koha::Object

This patch adds a new method to t::lib::TestBuilder so it can return
Koha::Object-derived objects. The new method is called ->build_object
and requires the plural of the target class to be passed.

'class' is a mandatory param, and a warning is raised and undef is
returned if absent.

It accepts 'value' as the original ->build() method, and that is passed as-is
to ->build().

To test:
- Apply the patches
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/db_dependent/TestBuilder.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/db_dependent/TestBuilder.t
t/lib/TestBuilder.pm