Skip Menu |

This queue is for tickets about the Apache-Test CPAN distribution.

Report information
The Basics
Id: 32993
Status: resolved
Priority: 0/
Queue: Apache-Test

People
Owner: Nobody in particular
Requestors: MAHEX [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.30
Fixed in: (no value)

Attachments


Apache::TestHarnessPHP needs to use TAP::Harness. Also, in its current state, it seems not to support PHP cli tests as the POD suggests.
Subject: 02-apache-testharness.dpatch
Download 02-apache-testharness.dpatch
application/octet-stream 2.8k

Message body not shown because it is not plain text.

From: pgollucci [...] p6m7g8.com
On Thu Feb 07 10:15:41 2008, MAHEX wrote: Show quoted text
> Apache::TestHarnessPHP needs to use TAP::Harness. Also, in its current > state, it seems not to support PHP cli tests as the POD suggests.
I've not been following p5p or perl6 much lately, can you explain what this is accomplishing. Also, at first glance, this won't work in FreeBSD since php is in /usr/local/bin/php
Committed slightly modified, revision 935701. URL: http://svn.apache.org/viewvc?rev=935701&view=rev Log: https://rt.cpan.org/Public/Bug/Display.html?id=32993 use TAP::Harness for Apache::TestHarnessPHP Submitted by: Mark A. Hershberger Modified by: Fred Moyer Reviewed by: Phillip Gollucci, Fred Moyer Modified: perl/Apache-Test/trunk/Changes perl/Apache-Test/trunk/lib/Apache/TestHarnessPHP.pm Modified: perl/Apache-Test/trunk/Changes URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/Changes? rev=935701&r1=935700&r2=935701&view=diff ========================================================= ===================== --- perl/Apache-Test/trunk/Changes (original) +++ perl/Apache-Test/trunk/Changes Mon Apr 19 18:42:44 2010 @@ -8,6 +8,11 @@ Changes - Apache::Test change logfile =item 1.33-dev +https://rt.cpan.org/Public/Bug/Display.html?id=32993 +use TAP::Harness for Apache::TestHarnessPHP +[Mark A. Hershberger] + + https://rt.cpan.org/Public/Bug/Display.html?id=54476 Fix error where non root user gets test failure with httpd suexec and mod_fcgid [Peter (Stig) Edwards] Modified: perl/Apache-Test/trunk/lib/Apache/TestHarnessPHP.pm URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestHarnessPHP.pm? rev=935701&r1=935700&r2=935701&view=diff ========================================================= ===================== --- perl/Apache-Test/trunk/lib/Apache/TestHarnessPHP.pm (original) +++ perl/Apache-Test/trunk/lib/Apache/TestHarnessPHP.pm Mon Apr 19 18:42:44 2010 @@ -22,31 +22,12 @@ use File::Spec::Functions qw(catfile cat use File::Find qw(finddepth); use Apache::TestHarness (); use Apache::TestTrace; +use Apache::TestConfig (); use vars qw(@ISA); @ISA = qw(Apache::TestHarness); - -# 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; -}; +use TAP::Formatter::Console; +use TAP::Harness; sub get_tests { @@ -121,40 +102,38 @@ sub get_tests { 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, @_); + + $agg->start(); + $php_harness->aggregate_tests($agg, grep {m{\.php$}} @tests); + $perl_harness->aggregate_tests($agg, grep {m{\.t$}} @tests); + $agg->stop(); - $Test::Harness::verbose ||= $args->{verbose}; - - 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 $line = "php $switches $file"; + my $php = Apache::TestConfig::which('php') || + die 'no php executable found in ' . $ENV{PATH}; - return $line; + return ["env", "SERVER_ROOT=$server_root", + $php, "--php-ini", $ini, "--define", "include_path=$conf"]; } 1;