RT:  https://rt.cpan.org/Ticket/Display.html?id=32993

Please take a look at this revised patch here and give a +1, 0, or -1.  Thanks!


Index: lib/Apache/TestHarnessPHP.pm
===================================================================
--- lib/Apache/TestHarnessPHP.pm        (revision 934663)
+++ lib/Apache/TestHarnessPHP.pm        (working copy)
@@ -25,29 +25,13 @@

 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);
+my $phpbin = `which php`;
+chomp($phpbin);
+my $phpclient = -x `$phpbin`;

-  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 +105,35 @@
 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 $line = "php $switches $file";
-
-    return $line;
+    return ["env", "SERVER_ROOT=$server_root",
+            "$phpbin", "--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

Reply via email to