/usr/share/perl5/Dist/Zilla/App/Tester.pm is in libdist-zilla-perl 5.043-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | use strict;
use warnings;
package Dist::Zilla::App::Tester;
# ABSTRACT: testing library for Dist::Zilla::App
$Dist::Zilla::App::Tester::VERSION = '5.043';
use parent 'App::Cmd::Tester::CaptureExternal';
use App::Cmd::Tester 0.306 (); # result_class, ->app
use Dist::Zilla::App;
use File::Copy::Recursive qw(dircopy);
use File::pushd ();
use File::Spec;
use File::Temp;
use Path::Class;
use Sub::Exporter::Util ();
use Sub::Exporter -setup => {
exports => [ test_dzil => Sub::Exporter::Util::curry_method() ],
groups => [ default => [ qw(test_dzil) ] ],
};
sub result_class { 'Dist::Zilla::App::Tester::Result' }
sub test_dzil {
my ($self, $source, $argv, $arg) = @_;
$arg ||= {};
local @INC = map {; File::Spec->rel2abs($_) } @INC;
my $tmpdir = $arg->{tempdir} || File::Temp::tempdir(CLEANUP => 1);
my $root = dir($tmpdir)->subdir('source');
$root->mkpath;
dircopy($source, $root);
my $wd = File::pushd::pushd($root);
local $ENV{DZIL_TESTING} = 1;
my $result = $self->test_app('Dist::Zilla::App' => $argv);
$result->{tempdir} = $tmpdir;
return $result;
}
{
package Dist::Zilla::App::Tester::Result;
$Dist::Zilla::App::Tester::Result::VERSION = '5.043';
BEGIN { our @ISA = qw(App::Cmd::Tester::Result); }
sub tempdir {
my ($self) = @_;
return $self->{tempdir};
}
sub zilla {
my ($self) = @_;
return $self->app->zilla;
}
sub build_dir {
my ($self) = @_;
return $self->zilla->built_in;
}
sub clear_log_events {
my ($self) = @_;
$self->app->zilla->logger->logger->clear_events;
}
sub log_events {
my ($self) = @_;
$self->app->zilla->logger->logger->events;
}
sub log_messages {
my ($self) = @_;
[ map {; $_->{message} } @{ $self->app->zilla->logger->logger->events } ];
}
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Dist::Zilla::App::Tester - testing library for Dist::Zilla::App
=head1 VERSION
version 5.043
=head1 AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|