One other issue occurred to me; TAP::Harness will now be a dependency. What are people's thoughts on that? TAP::Harness is included in 5.12, but not 5.10. Test::Harness is bundled with earlier versions of perl. We use Test::Harness extensively in Apache::Test, so this would be switching part of Apache::Test but not all of it.
Thoughts? On Thu, Apr 15, 2010 at 8:35 PM, Fred Moyer <f...@redhotpenguin.com> wrote: > On Thu, Apr 15, 2010 at 7:25 PM, Philip M. Gollucci > <pgollu...@p6m7g8.com> wrote: >> I forget where off the top of my head, but A-T has a function to search >> $PATH for binaries. > > Apache::TestConfig::which('binary'); > > And aptly named, thanks for the spot on my previous hack. I'm not > sure how to test this specifically, so I'm cc'ing test-dev in the > event there are some PHP Apache::Test users there. > > Index: lib/Apache/TestHarnessPHP.pm > =================================================================== > --- lib/Apache/TestHarnessPHP.pm (revision 934663) > +++ lib/Apache/TestHarnessPHP.pm (working copy) > @@ -22,32 +22,13 @@ > use File::Find qw(finddepth); > use Apache::TestHarness (); > use Apache::TestTrace; > +use Apache::TestConfig (); > > use vars qw(@ISA); > �...@isa = qw(Apache::TestHarness); > +use TAP::Formatter::Console; > +use TAP::Harness; > > -# Test::Harness didn't start using Test::Harness::Straps until 2.38 > -# everything except t/foo.php with earlier versions, so let things go > -# on without it > -my $phpclient = eval { > - require Test::Harness; > - Test::Harness->VERSION(2.38); > - > - push @ISA, qw(Test::Harness::Straps); > - > - $Test::Harness::Strap = __PACKAGE__->new; > - > - # yes, this is ugly, ugly, ugly > - $Test::Harness::Strap->{callback} = sub { > - my($self, $line, $type, $totals) = @_; > - print $line if $Test::Harness::Verbose; > - my $meth = *Handlers{$type}; > - $meth->($self, $line, $type, $totals) if $meth; > - }; > - > - 1; > -}; > - > sub get_tests { > > my $self = shift; > @@ -121,40 +102,38 @@ > sub run { > my $self = shift; > my $args = shift || {}; > + my $formatter = TAP::Formatter::Console->new; > + my $agg = TAP::Parser::Aggregator->new; > + my $verbose = $args->{verbose} && $args->{verbose}; > + my $php_harness = TAP::Harness->new > + ({exec => $self->command_line(), > + verbosity => $verbose}); > + my $perl_harness = TAP::Harness->new > + ({verbosity => $verbose}); > + my @tests = $self->get_tests($args, @_); > > - $Test::Harness::verbose ||= $args->{verbose}; > + $agg->start(); > + $php_harness->aggregate_tests($agg, grep {m{\.php$}} @tests); > + $perl_harness->aggregate_tests($agg, grep {m{\.t$}} @tests); > + $agg->stop(); > > - if (my(@subtests) = @{ $args->{subtests} || [] }) { > - $ENV{HTTPD_TEST_SUBTESTS} = "@subtests"; > - } > - > - Test::Harness::runtests($self->get_tests($args, @_)); > + $formatter->summary($agg); > } > > -sub _command_line { > - > +sub command_line { > my $self = shift; > - my $file = shift; > > - return $self->SUPER::_command_line($file) > - unless $file =~ m/\.php$/; > - > - $file = qq["$file"] if ($file =~ /\s/) && ($file !~ /^".*"$/); > - > my $server_root = Apache::Test::vars('serverroot'); > > - $ENV{SERVER_ROOT} = $server_root; > - > my $conf = catfile($server_root, 'conf'); > > my $ini = catfile($conf, 'php.ini'); > > - my $switches = join ' ', "--php-ini $ini", > - "--define include_path=$conf"; > + my $php = Apache::TestConfig::which('php') || > + die 'no php executable found in ' . $ENV{PATH}; > > - my $line = "php $switches $file"; > - > - return $line; > + return ["env", "SERVER_ROOT=$server_root", > + $php, "--php-ini", $ini, "--define", "include_path=$conf"]; > } > > 1; > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org For additional commands, e-mail: dev-h...@perl.apache.org