blob: e65d689509e4219b6a0da0d68dd8bc9e37f29462 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 $/; <P> . "" };
chomp $res;
waitpid $pid, 0;
if ( $? == 0 ) {
ok 1 => "Looks fine";
} else {
ok 0 => "$file does not pass php linter. Error was: $res";
}
}
|