The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Mockify::Verify - To verify mock interactions

DESCRIPTION

Sometimes you will need to verify that a specific method was called a certain amount of times, each time with specific parameters. Mockify provides the following methods to access this data.

METHODS

GetParametersFromMockifyCall

  my $aParameters = GetParametersFromMockifyCall($MockifiedObject, 'nameOfMethod', $OptionalPosition);

This function returns all the parameters after the mockified module was used. If the test calls the method multiple times, the "$OptionalPosition" can be used to get the specific call. The default is "0". Returns an array ref with the parameters of the specific method call. (Note: The calls are counted starting from zero. You will get the parameters from the first call with 0, the ones from the second call with 1, and so on.)

WasCalled

  my $WasCalled = WasCalled($MockifiedObject, 'nameOfMethod');

This function returns the information if the method was called on the mockified module.

GetCallCount

  my $AmountOfCalls = GetCallCount($MockifiedObject, 'nameOfMethod');

This function returns the information on how often the method was called on the mockified module. If the method was not called it will return "0".

LICENSE

Copyright (C) 2017 ePages GmbH

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Christian Breitkreutz <christianbreitkreutz@gmx.de>