VERSION
Version 0.34
DESCRIPTION
Plans mock strategy for each method that has external side effects, based on side effect analysis metadata in the schema. Methods that call external commands are assigned a system mock; methods that perform IO are assigned IO capture. Used by App::Test::Generator::Emitter::Perl to generate appropriate mock setup code in the test output.
new
Construct a new Mock planner.
my $planner = App::Test::Generator::Planner::Mock->new;
Arguments
None.
Returns
A blessed hashref.
API specification
input
{}
output
{
type => OBJECT,
isa => 'App::Test::Generator::Planner::Mock',
}
plan
Produce a mock plan for each method that requires external mocking, based on side effect analysis metadata in the schema.
my $planner = App::Test::Generator::Planner::Mock->new;
my $mock_plan = $planner->plan($schema);
for my $method (keys %{$mock_plan}) {
printf "%s: %s\n", $method, $mock_plan->{$method};
}
Arguments
$schemaA hashref of method schemas, each optionally containing a
_analysiskey with aside_effectssub-key as produced by App::Test::Generator::Analyzer::SideEffect.
Returns
A hashref mapping method names to mock strategy strings. Only methods that require mocking appear in the output — pure methods are omitted.
Currently supported strategy values are mock_system and capture_io. If a method both calls external commands and performs IO, mock_system takes precedence. This is a known limitation and may be revised in a future version to support multiple strategies per method.
API specification
input
{
self => { type => OBJECT, isa => 'App::Test::Generator::Planner::Mock' },
schema => { type => HASHREF },
}
output
{
type => HASHREF,
keys => {
'*' => { type => SCALAR },
},
}
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 91:
Non-ASCII character seen before =encoding in '—'. Assuming UTF-8