1
Testing PHP with Perl
Chris Shiflett
shiflett@php.net
Geoffrey Young
geoff@modperlcookbook.org
Testing PHP with Perl Chris Shiflett shiflett@php.net Geoffrey - - PowerPoint PPT Presentation
Testing PHP with Perl Chris Shiflett shiflett@php.net Geoffrey Young geoff@modperlcookbook.org 1 PHP and Perl? Testing a basic PHP application Using the Apache-Test framework 2 3 The Code 4 admin/add.php <?php include
1
Chris Shiflett
shiflett@php.net
Geoffrey Young
geoff@modperlcookbook.org
2
3
4
5
<?php include '../functions.inc'; ... if (add_user($_POST['username'], $_POST['password'])) { echo '<p>User Added</p>'; echo '<p><a href="/admin/">Admin Home</a></p>'; } ?>
6
7
8
<?php require 'test-more.php'; require "{$_SERVER['DOCUMENT_ROOT']}/functions.inc"; plan(2); { # no user or password $rc = add_user('', '');
} { # some generic user/password $rc = add_user('user', 'password');
# cleanup delete_user('user'); } ?>
9
10
not ok 1 - no user/pass fails # Failed test (add_user.php at line 10)
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
AddType application/x-httpd-php .php DirectoryIndex index.php index.html <IfModule @PHP_MODULE@> php_flag register_globals On </IfModule>
27
AddType application/x-httpd-php .php DirectoryIndex index.php index.html <IfModule mod_php5.c> php_flag register_globals On </IfModule>
28
29
30
31
32
perl Makefile.PL -httpd /path/to/httpd
33
34
http://www.modperlcookbook.org/~geoff/slides/ApacheCon/2004/perl-php-test.tar.gz
35