| 1 | package Poet::t::Environment; | ||||||||||
| 2 | 1 | $Poet::t::Environment::VERSION = '0.16'; | |||||||||
| 3 | 1 | ▶ | use Test::Class::Most parent => 'Poet::Test::Class'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Poet::Tools qw(mkpath tempdir_simple write_file); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Poet::Environment::Generator; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | sub test_environment : Tests { | ||||||||
|
Subroutine
test_environment: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 8 | 1 | my $self = shift; | |||||||||
| 9 | |||||||||||
| 10 | 1 | my $app_name = 'TheTestApp'; | |||||||||
| 11 | 1 | my $poet = $self->temp_env( app_name => $app_name ); | |||||||||
| 12 | 1 | my $root_dir = $poet->root_dir; | |||||||||
| 13 | |||||||||||
| 14 | 1 | foreach my $subdir (qw(bin conf lib)) { | |||||||||
| 15 | 3 | my $subdir_method = $subdir . "_dir"; | |||||||||
| 16 | 3 | is( $poet->$subdir_method, "$root_dir/$subdir", $subdir_method ); | |||||||||
| 17 | 3 | ok( -d $poet->$subdir_method, "$subdir exists" ); | |||||||||
| 18 | 3 | ok( -d $poet->path($subdir), "$subdir exists" ); | |||||||||
| 19 | } | ||||||||||
| 20 | 1 | is( $poet->conf->layer, 'development', "layer" ); | |||||||||
| 21 | 1 | foreach my $class (qw(Conf Log Mason)) { | |||||||||
| 22 | 3 | my $file = $poet->lib_path("$app_name/$class.pm"); | |||||||||
| 23 | 3 | ok( -f $file, "$file exists" ); | |||||||||
| 24 | } | ||||||||||
| 25 | 1 | ok( -x $poet->bin_path("run.pl"), "run.pl executable" ); | |||||||||
| 26 | 1 | ok( -x $poet->bin_path("get.pl"), "get.pl executable" ); | |||||||||
| 27 | 1 | ▶ | } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | 1 | ▶ | sub test_dot_files_in_share_dir : Tests { | ||||||||
|
Subroutine
test_dot_files_in_share_dir: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 30 | 1 | my $self = shift; | |||||||||
| 31 | 1 | ▶ | return 'author testing' if $ENV{AUTHOR_TESTING}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 1 | require File::Copy::Recursive; | |||||||||
| 33 | |||||||||||
| 34 | 1 | my $share_dir = $self->share_dir; | |||||||||
| 35 | 1 | my $temp_dir = tempdir_simple(); | |||||||||
| 36 | 1 | ▶ | File::Copy::Recursive::rcopy( $share_dir, $temp_dir ) or die $!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 1 | my $gen_dir = "$temp_dir/generate.skel"; | |||||||||
| 38 | 1 | my @paths = ( "$gen_dir/extra", "$gen_dir/.git", "$gen_dir/bin/.svn" ); | |||||||||
| 39 | 1 | foreach my $path (@paths) { | |||||||||
| 40 | 3 | mkpath( $path, 0, 0775 ); | |||||||||
| 41 | 3 | write_file( "$path/hi.txt", "hi" ); | |||||||||
| 42 | } | ||||||||||
| 43 | 1 | my $env_dir = $self->temp_env_dir( share_dir => $temp_dir ); | |||||||||
| 44 | 1 | ok( -d "$env_dir/extra", "extra exists" ); | |||||||||
| 45 | 1 | ok( !-d "$env_dir/.git", ".git does not exist" ); | |||||||||
| 46 | 1 | ok( !-d "$env_dir/bin/.svn", ".svn does not exist" ); | |||||||||
| 47 | 1 | ▶ | } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 48 | |||||||||||
| 49 | 1 | 1; | |||||||||