[Koha-bugs] [Bug 17944] Remove the sql code from itemtypes.pl administrative perl script

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Feb 2 08:54:56 CET 2017


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

--- Comment #25 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
(In reply to Alex Buckley from comment #22)
> (in reply to Jonathan Druart in comment 21)
> 
> 1/ What tests specifically do you want?

When a subroutine or a method is added or updated, we need to provide tests
("unit tests") in the t directory.
For a method like "Koha::ItemType->is_used" you will want to add tests to
t/db_dependent/Koha/ItemTypes.t.
Create a new subtest per method is a good idea (`git grep subtest t` to see
examples)
In your case you want to test that this new method returns true if at least 1
item and/or 1 biblioitem is using it. Otherwise it returns false.

(In reply to Alex Buckley from comment #24)
> (in reply to Jonathan Druart in comment 21)
> Could you please explain what you mean in your point 5? Are you asking why I
> havent put the is_used subroutine in the Koha::Items and Koha::Biblioitems
> files?

Instead of using
  $schema->resultset('Item')->search
you can use
  Koha::Items->search

We have Koha objects to represent our data model, so when they exist
(Koha::Items and Koha::Biblioitems do exist) it's better to use them.

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


More information about the Koha-bugs mailing list