line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Parser::SourceHandler::PHP; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
957987
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use TAP::Parser::IteratorFactory (); |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
11
|
|
7
|
1
|
|
|
1
|
|
5
|
use TAP::Parser::Iterator::Process (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
301
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw( TAP::Parser::SourceHandler ); |
10
|
|
|
|
|
|
|
TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
TAP::Parser::SourceHandler::PHP - Runs PHP programs to get their TAP for prove |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 VERSION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Version 0.01 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This module is a plugin to let you run PHP programs under F. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
prove --source Perl \ |
29
|
|
|
|
|
|
|
--source PHP --php-option include_path=/tmp/foo |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 CLASS METHODS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 $handler->can_handle( $source ) |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Tells whether we should handle the file as a PHP test. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub can_handle { |
40
|
0
|
|
|
0
|
1
|
|
my ( $class, $source ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $meta = $source->meta; |
43
|
0
|
|
|
|
|
|
my $config = $source->config_for( 'PHP' ); |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
return 0 unless $meta->{is_file}; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $suf = $meta->{file}{lc_ext}; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
0
|
|
|
|
my $wanted_extension = $config->{extension} || '.php'; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
return 1 if $suf eq $wanted_extension; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
return 0; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 C |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $iterator = $class->make_iterator( $source ); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Returns a new iterator for the source. C<< $source->raw >> must be either |
61
|
|
|
|
|
|
|
a file name or a scalar reference to the file name. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=over |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item include_path |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Paths to include for PHP to search for files. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=back |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub make_iterator { |
74
|
0
|
|
|
0
|
1
|
|
my ( $class, $source ) = @_; |
75
|
0
|
|
|
|
|
|
my $config = $source->config_for('PHP'); |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
0
|
|
|
|
my @command = ( $config->{php} || '/usr/local/bin/php' ); |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $include_path = $config->{include_path}; |
80
|
0
|
0
|
|
|
|
|
if ( $include_path ) { |
81
|
0
|
|
|
|
|
|
push( @command, "-dinclude_path=$include_path" ); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
my $fn = ref $source->raw ? ${ $source->raw } : $source->raw; |
|
0
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
push( @command, $fn ); |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return TAP::Parser::Iterator::Process->new( { |
88
|
|
|
|
|
|
|
command => \@command, |
89
|
|
|
|
|
|
|
merge => $source->merge |
90
|
|
|
|
|
|
|
}); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SEE ALSO |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
L, |
96
|
|
|
|
|
|
|
L, |
97
|
|
|
|
|
|
|
L, |
98
|
|
|
|
|
|
|
L, |
99
|
|
|
|
|
|
|
L, |
100
|
|
|
|
|
|
|
L, |
101
|
|
|
|
|
|
|
L, |
102
|
|
|
|
|
|
|
L, |
103
|
|
|
|
|
|
|
L |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Andy Lester, C<< >> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 BUGS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
112
|
|
|
|
|
|
|
C, |
113
|
|
|
|
|
|
|
or through the web interface at |
114
|
|
|
|
|
|
|
L. |
115
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of |
116
|
|
|
|
|
|
|
progress on your bug as I make changes. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SUPPORT |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
perldoc TAP::Parser::SourceHandler::PHP |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
You can also look for information at: |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=over 4 |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
L |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item * CPAN Ratings |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
L |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * Search CPAN |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
L |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=back |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Thanks to David Wheeler for being able to steal from his pgTAP |
149
|
|
|
|
|
|
|
SourceHandler. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
L |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Copyright 2010 Andy Lester. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This program is released under the Artistic License v2.0. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; # End of TAP::Parser::SourceHandler::PHP |