The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Test::CallFlow::Plan

Contains planned calls to mocked functions.

METHODS

new

  my $mock_call_plan = Test::CallFlow::Plan->new( %properties );

add_call

  $mock_call_plan->add_call( Test::CallFlow::Call->new( 'subname', @args ) );

Adds a call into this plan.

call

  $mock_call_plan->call( 'subname', @args );

Heart of plan execution. Searches for a matching call and returns the result.

This should be shortened for ease of further development. Then again, it seems to work.

failed_call

  $mock_call_plan->failed_call( $called, $calls, \@errors );

Used by call() to report errors. Croaks with a list of tried and failed call proposals.

unsatisfied

Returns an array of remaining unsatisfied calls.

Whole plan can be seen as successfully executed once this returns an empty array.

reset

  $plan->reset;

Return to planning state, preserving all previously made plans and discarding any results of running.

list_calls

Returns the list of calls in this plan.