Important restrictions

  • Variables may not be recorded if the PHP code uses exit() or die(). To fix this use return instead.
  • Cookies are not supported as of now.

Installation

To install phpautotest first run install.php. To change any settings edit phpautotest_config.php in the includes folder. The file is self-explanatory, pay particular attention to the first 16 lines.

Testing HTML output

You can ask phpautotest to search for particular text in the HTML output, if it cannot be found it is mentioned in the test report. Text can be tested using regular expressions. Characters such as ^.[]$()|*+?{\ have to be escaped using \ as they are used in pattern matching.

You can ask phpautotest to display all the text it found when it was recording the test case, this text is already escaped and it is strongly suggested you use it. If you're not familiar with pattern matching using regular expressions please refer to the PHP manual.

Testing PHP variables

Variables stored at the time of recording a test case are stored in an array named $expected. Variables stored during the regression test are stored in array named $actual. A sample test can be viewed by clicking paste default php test code.