VERSION

Version 0.34

DESCRIPTION

Plans fixture setup strategy for each method under test, based on the isolation requirements provided by App::Test::Generator::Planner::Isolation. Methods that share state are assigned a shared fixture; all others get a fresh fixture per test.

new

Construct a new Fixture planner.

my $planner = App::Test::Generator::Planner::Fixture->new;

Arguments

None.

Returns

A blessed hashref.

API specification

input

{}

output

{
    type => OBJECT,
    isa  => 'App::Test::Generator::Planner::Fixture',
}

plan

Produce a fixture plan for each method based on its isolation mode. Methods with isolation mode shared_fixture are assigned a shared fixture; all other methods get a fresh fixture per test.

my $planner   = App::Test::Generator::Planner::Fixture->new;
my $fixture   = $planner->plan($schema, $isolation);

for my $method (keys %{$fixture}) {
    printf "%s: %s\n", $method, $fixture->{$method}{mode};
}

Arguments

  • $schema

    A hashref representing the module schema. Currently unused but reserved for future fixture customisation based on schema metadata.

  • $isolation

    A hashref mapping method names to isolation mode strings as produced by App::Test::Generator::Planner::Isolation.

Returns

A hashref mapping method names to fixture plan hashrefs, each with a mode key set to either shared or new_per_test.

API specification

input

{
    self      => { type => OBJECT,  isa     => 'App::Test::Generator::Planner::Fixture' },
    schema    => { type => HASHREF },
    isolation => { type => HASHREF },
}

output

{
    type  => HASHREF,
    keys  => {
        '*' => {
            type => HASHREF,
            keys => { mode => { type => SCALAR } },
        },
    },
}