Apache-Test

 view release on metacpan or  search on metacpan

lib/Apache/TestConfigPHP.pm  view on Meta::CPAN

  local $/ = "END_OF_FILE\n";

  $php_ini = <DATA>;
  chomp $php_ini;

  $test_more = <DATA>;
  chomp $test_more;
}

sub new {
    return shift->SUPER::new(@_);
}

my %warn_style = (
    html    => sub { "<!-- @_ -->" },
    c       => sub { "/* @_ */" },
    ini     => sub { join '', grep {s/^/; /gm} @_ },
    php     => sub { join '', "<?php\n", grep {s/^/# /gm} @_ },
    default => sub { join '', grep {s/^/\# /gm} @_ },
);

lib/Apache/TestConfigParrot.pm  view on Meta::CPAN

use File::Find qw(finddepth);
use Apache::TestTrace;
use Apache::TestRequest;
use Apache::TestConfig;
use Apache::TestConfigPerl;
use Config;

@Apache::TestConfigParrot::ISA = qw(Apache::TestConfig);

sub new {
    return shift->SUPER::new(@_);
}

sub configure_parrot_tests_pick {
    my($self, $entries) = @_;

    for my $subdir (qw(Response)) {
        my $dir = catfile $self->{vars}->{t_dir}, lc $subdir;
        next unless -d $dir;

        finddepth(sub {

lib/Apache/TestMB.pm  view on Meta::CPAN

use Module::Build 0.18;
use Apache::Test ();
use Apache::TestConfig ();
@ISA = qw(Module::Build);

sub new {
    my $pkg = shift;
    my($argv, $vars) =
        Apache::TestConfig::filter_args(\@ARGV, \%Apache::TestConfig::Usage);
    @ARGV = @$argv;
    my $self = $pkg->SUPER::new(@_);
    $self->{properties}{apache_test_args} = $vars;
    $self->{properties}{apache_test_script} ||= 't/TEST';
    $self->generate_script;
    return $self;
}

sub valid_property {
    return 1 if defined $_[1] &&
        ($_[1] eq 'apache_test_args' || $_[1] eq 'apache_test_script');
    shift->SUPER::valid_property(@_);
}

sub apache_test_args {
    my $self = shift;
    $self->{properties}{apache_test_args} = shift if @_;
    return $self->{properties}{apache_test_args};
}

sub apache_test_script {
    my $self = shift;

lib/Apache/TestMB.pm  view on Meta::CPAN

    my $self = shift;
    # XXX I'd love to do this without t/TEST.
    $self->do_system( $self->perl, $self->_bliblib,
                      $self->localize_file_path($self->apache_test_script),
                      '-clean');
}

sub ACTION_clean {
    my $self = shift;
    $self->depends_on('test_clean');
    $self->SUPER::ACTION_clean(@_);
}

sub ACTION_run_tests {
    my $self = shift;
    $self->depends_on('test_clean');
    # XXX I'd love to do this without t/TEST.
    $self->do_system($self->perl, $self->_bliblib,
                     $self->localize_file_path($self->apache_test_script),
                     '-bugreport', '-verbose=' . ($self->verbose || 0));
}

lib/Apache/TestRequest.pm  view on Meta::CPAN


sub wanted_args {
    \%wanted_args;
}

sub redirect_ok {
    my $self = shift;
    if ($have_lwp) {
        # Return user setting or let LWP handle it.
        return $RedirectOK if defined $RedirectOK;
        return $self->SUPER::redirect_ok(@_);
    }

    # No LWP. We don't support redirect on POST.
    return 0 if $self->method eq 'POST';
    # Return user setting or our internal calculation.
    return $RedirectOK if defined $RedirectOK;
    return $REDIR;
}

my %credentials;

#subclass LWP::UserAgent
sub new {
    my $self = shift->SUPER::new(@_);

    lwp_debug(); #init from %ENV (set by Apache::TestRun)

    my $config = Apache::Test::config();
    if (my $proxy = $config->configure_proxy) {
        #t/TEST -proxy
        $self->proxy(http => "http://$proxy");
    }

    $self->timeout(UA_TIMEOUT);

lib/Apache/TestRun.pm  view on Meta::CPAN

  package My::TestRun;
  use base 'Apache::TestRun';
  use Apache::TestConfig;
  __PACKAGE__->new->run(@ARGV);

  sub pre_configure {
      my $self = shift;
      # Don't load an installed mod_apreq
      Apache::TestConfig::autoconfig_skip_module_add('mod_apreq.c');

      $self->SUPER::pre_configure();
  }

Notice that the extension is I<.c>, and not I<.so>.

Don't forget to run the super class' c<pre_configure()> method.



=head2 C<new_test_config>

lib/Apache/TestRunPHP.pm  view on Meta::CPAN

use vars qw(@ISA);
@ISA = qw(Apache::TestRun);

sub start {
    my $self = shift;

    # point php to our own php.ini file
    $ENV{PHPRC} = catfile $self->{test_config}->{vars}->{serverroot},
                          'conf';

    $self->SUPER::start(@_);
}

sub new_test_config {
    my $self = shift;

    Apache::TestConfigPHP->new($self->{conf_opts});
}

sub configure_php {
    my $self = shift;

lib/Apache/TestRunPHP.pm  view on Meta::CPAN

                                        configure_php_ini
                                        configure_php_functions
                                        configure_php_tests));
}

sub configure {
    my $self = shift;

    $self->configure_php;

    $self->SUPER::configure;
}

#if Apache::TestRun refreshes config in the middle of configure
#we need to re-add php configure hooks
sub refresh {
    my $self = shift;
    $self->SUPER::refresh;
    $self->configure_php;
}

my @request_opts = qw(get post head);

sub run_tests {
    my $self = shift;

    my $test_opts = {
        verbose => $self->{opts}->{verbose},

lib/Apache/TestRunParrot.pm  view on Meta::CPAN

    my $test_config = $self->{test_config};

    $test_config->postamble_register(qw(configure_parrot_tests));
}

sub configure {
    my $self = shift;

    $self->configure_parrot;

    $self->SUPER::configure;
}

#if Apache::TestRun refreshes config in the middle of configure
#we need to re-add parrotconfigure hooks
sub refresh {
    my $self = shift;
    $self->SUPER::refresh;
    $self->configure_parrot;
}

1;
__END__

lib/Apache/TestRunPerl.pm  view on Meta::CPAN

                                        configure_pm_tests_inc
                                        configure_startup_pl
                                        configure_pm_tests));
}

sub configure {
    my $self = shift;

    $self->configure_modperl;

    $self->SUPER::configure;
}

#if Apache::TestRun refreshes config in the middle of configure
#we need to re-add modperl configure hooks
sub refresh {
    my $self = shift;
    $self->SUPER::refresh;
    $self->configure_modperl;
}

1;
__END__

=head1 NAME

Apache::TestRunPerl - Run mod_perl-requiring Test Suite

t/TEST.PL  view on Meta::CPAN

#perl t/TEST apxs ...
#cat t/conf/extra.conf
#perl t/TEST -clean

sub new_test_config {
    my $self = shift;

    $self->{conf_opts}->{authname}      = 'gold club';
    $self->{conf_opts}->{allowed_users} = 'dougm sterling';

    return $self->SUPER::new_test_config;
}

sub bug_report {
    my $self = shift;

    print <<EOI;
+-----------------------------------------------------+
| To report problems please refer to the SUPPORT file |
+-----------------------------------------------------+
EOI



( run in 1.203 second using v1.01-cache-2.11-cpan-49f99fa48dc )