[Koha-bugs] [Bug 28615] Add a simple way to mock Koha::Logger

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jun 23 02:25:50 CEST 2021


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

--- Comment #9 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
(In reply to David Cook from comment #8)
> Ah, here we go: 
> 
> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477
> 
> That unit test code could be refined but it works without any mocking.

My goal is to make it trivial for devs to test behavior. There's nothing
intrinsically bad about mocking the logger. Or doing it your way.

You are actually mocking some other part of the same thing (the configuration)
and manually capturing STDOUT/STDERR instead of 'the warn trick'.

Your code is correct, and makes my point. Compare that boilerplate for just
testing the logger is called, to just calling:

t::lib::Mocks::mock_logger({warn=>1});

warning_is {}...

Anyways, I always like different opinions and am open about this.

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


More information about the Koha-bugs mailing list