Test::Mockify::Verify - To verify mock interactions
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.
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.)
my $WasCalled = WasCalled($MockifiedObject, 'nameOfMethod');
This function returns the information if the method was called on the mockified module.
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".
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.
Christian Breitkreutz <christianbreitkreutz@gmx.de>
To install Test::Mockify, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Mockify
CPAN shell
perl -MCPAN -e shell install Test::Mockify
For more information on module installation, please visit the detailed CPAN module installation guide.