Continuously test acceptance of PHP/MySQL sites.
Specify the MySQL root
user's password and the test MySQL user name by adding a test_sites.json
configuration file in the directory priv
.
When no priv/test_sites.json
configuration file exist the defaults are :
{
"mysqlRootPass": "",
"mysqlTestUser": "test"
}
To get the test sites status :
./lamp
Create a test/sites/mysite
directory with a test_sites.json
default configuration once :
./lamp init mysite
Note that there is a WordPress extension for lamp
called press
that takes care of the particularities of WordPress beyond PHP/MySQL.
./press
You can cook your own extension and maybe address Drupal's or Joomla specifics by looking in test_press.py
how to extend test_sites.py
.
This project includes a WordPress sample site in test/sites/wordpress
:
{
"httpHost": "127.0.0.1:8089",
"gitSource": "deps/wordpress",
"gitBranch": "3.9",
"testUnits": [
"wp_install.js"
]
}
With this configuration the site will: use a shared repository found in deps/wordpress
to checkout branch 3.9
as its run
directory; which will be served by a PHP built-in server listening on 127.0.0.1:8089
; and the script test/units/wp_install.js
will be executed by Casperjs when testing the site.
Setup a site, start its server, run its test units, stop the server, dump its full database and its test site's run
repository changes to zip archives and finally tear down the site.
./press run wordpress
Use this command for continuous integration.
Setup a site and start its server if not allready up, run its test units.
./press test wordpress
Use this command if you want to test a site repeatedly or inspect its files and database afterwards.
Dump the compressed database in out/mysql.zip
, compress the new or updated files in in out/run.zip
.
./press test wordpress
./press dump wordpress
Use this command to dump a site's state for further testing
Test a site and merge its input and output into a new site
./press test wordpress
./press dump wordpress
./press step wordpress wp39-installed
Use this command to build one or more test cases step by step.
Create the site's database, if the file exists decompress and import mysql.zip
into that new database, create a run
directory, check out a branch of a shared git repository if specified in the configuration, if it exists decompress the content of run.zip
:
./press up wordpress
Use this command if you want to inspect a site before testing it.
Start the builtin PHP server. For instance, to restart the wordpress
site :
./press start wordpress
Returns an error if the site is already running or has not been setup.
Stop the builtin PHP server :
./press stop wordpress
Returns an error if the site is not running.
Teardown the site :
./press down wordpress
...