| 1 | package App::Test::Generator::Exporter::YAML; | ||||||||||
| 2 | |||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 7 | ▶ | use Params::Validate::Strict 0.30; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 7 | ▶ | use YAML::XS; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 7 | our $VERSION = '0.50'; | |||||||||
| 9 | |||||||||||
| 10 | =head1 NAME | ||||||||||
| 11 | |||||||||||
| 12 | App::Test::Generator::Exporter::YAML - Serialise a test plan to YAML | ||||||||||
| 13 | |||||||||||
| 14 | =head1 VERSION | ||||||||||
| 15 | |||||||||||
| 16 | Version 0.50 | ||||||||||
| 17 | |||||||||||
| 18 | =cut | ||||||||||
| 19 | |||||||||||
| 20 | =head2 export | ||||||||||
| 21 | |||||||||||
| 22 | Serialise a plan hashref to a YAML file on disk. | ||||||||||
| 23 | |||||||||||
| 24 | =head3 Arguments | ||||||||||
| 25 | |||||||||||
| 26 | =over 4 | ||||||||||
| 27 | |||||||||||
| 28 | =item * C<$plan> | ||||||||||
| 29 | |||||||||||
| 30 | A hashref representing the test plan to serialise. | ||||||||||
| 31 | |||||||||||
| 32 | =item * C<$file> | ||||||||||
| 33 | |||||||||||
| 34 | A string. The path to the output YAML file. | ||||||||||
| 35 | |||||||||||
| 36 | =back | ||||||||||
| 37 | |||||||||||
| 38 | =head3 Returns | ||||||||||
| 39 | |||||||||||
| 40 | Nothing. | ||||||||||
| 41 | |||||||||||
| 42 | =head3 API specification | ||||||||||
| 43 | |||||||||||
| 44 | =head4 input | ||||||||||
| 45 | |||||||||||
| 46 | { | ||||||||||
| 47 | self => { type => 'object' }, | ||||||||||
| 48 | plan => { type => 'hashref' }, | ||||||||||
| 49 | file => { type => 'string', min => 1 }, | ||||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | =head4 output | ||||||||||
| 53 | |||||||||||
| 54 | { type => UNDEF } | ||||||||||
| 55 | |||||||||||
| 56 | =cut | ||||||||||
| 57 | |||||||||||
| 58 | 20 | ▶ | sub export { | ||||||||
|
Subroutine
export: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 59 | 20 | my ($self, $plan, $file) = @_; | |||||||||
| 60 | |||||||||||
| 61 | 20 | my %args; | |||||||||
| 62 | 20 | ▶ | $args{plan} = $plan if defined $plan; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 20 | ▶ | $args{file} = $file if defined $file; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | |||||||||||
| 65 | 20 | my $params = Params::Validate::Strict::validate_strict({ | |||||||||
| 66 | args => \%args, | ||||||||||
| 67 | schema => { | ||||||||||
| 68 | plan => { type => 'hashref' }, | ||||||||||
| 69 | file => { type => 'string', min => 1 }, | ||||||||||
| 70 | } | ||||||||||
| 71 | }); | ||||||||||
| 72 | |||||||||||
| 73 | 11 | YAML::XS::DumpFile($params->{file}, $params->{plan}); | |||||||||
| 74 | |||||||||||
| 75 | 9 | return; | |||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | 7 | 1; | |||||||||