http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5327

Julian Maurice <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #219 from Julian Maurice <[email protected]> ---
Hello all,

Jonathan tells me to try DBD::Mock for one of my patch (Bug 5339), which I did.
But I noticed some odd behaviour and I'm wondering if we are using it like we
should.
Example:

# This assume C4::Context::_new_dbh is mocked.

my $rs = [
    ['id', 'column1', ...],
    [1, 'a', ...],
    [2, 'b', ...]
];
my $dbh = C4::Context->dbh;
$dbh->{mock_add_resultset} = $rs;
my @a = my_function();


my_function execute a single 'select' query and return data like in $rs,
but in fact, even if my query is "SELECT * FROM bar WHERE id=1", it returns
all the resultset. And even worse, if my query is something like
"SELECT foo FROM bar", the whole resultset is still returned.

My question is: how can we use DBD::Mock for testing subroutines while
subroutines
will always return what we expect, and not what they should?

Is there something I'm doing wrong or something I don't understand?

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to