From 79f6123f5006aea5bd423fdb6278d7d3ce8d628d Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 21 Apr 2007 16:27:06 +0000 Subject: [PATCH] Add a php linting test. --- t/maint/php-lint.t | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 t/maint/php-lint.t diff --git a/t/maint/php-lint.t b/t/maint/php-lint.t new file mode 100644 index 0000000000..e65d689509 --- /dev/null +++ b/t/maint/php-lint.t @@ -0,0 +1,33 @@ +#!/usr/bin/env perl +# +# Based on php-tag.t and eol-style +# +use strict; +use warnings; + +use Test::More; +use File::Find; +use IPC::Open3; +use File::Spec; +use Symbol qw(gensym); + +my $ext = qr/(?: php | inc )/x; +my @files; + +find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' ); + +plan tests => scalar @files ; + +for my $file (@files) { + open NULL, '+>', File::Spec->devnull and \*NULL or die; + my $pid = open3('<&NULL', \*P, '>&NULL', qw'php -l', $file); + my $res = do { local $/;

. "" }; + chomp $res; + waitpid $pid, 0; + + if ( $? == 0 ) { + ok 1 => "Looks fine"; + } else { + ok 0 => "$file does not pass php linter. Error was: $res"; + } +} -- 2.20.1