Behat is used to execute User Acceptance Tests written in Gherkin. These tests are stored in tests/features/
.
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
You can read the official documentation here
To install behat and other dependencies run the following command on the project root:
$ composer install
run the following command:
$ cp default.behat.yml behat.yml
Edit behat.yml file and customize your base_url
. The base_url
determines which phpList server you wish to test. This could be a local development copy running on your machine, or a remotely hosted server.
Create a database, but keep it empty
$ mysqladmin -uroot -p create phplisttestdb
$ mysqladmin -uroot -p -e "grant all on phplisttestdb.* to phplist@localhost identified by 'testpassword'"
Edit your phplist config.php
file to use these details
Some tests can only be run once before they change the system state upon which they depend. These tests should only be run once, or only in automated testing environments like Travis. Execute these and all other tests together by running the following command from within your phpList 3 code root directory:
$ vendor/bin/behat
Usually you will want to avoid running the first time tests and run all the others instead. To do so execute the following command from within your phpList 3 code root directory:
$ vendor/bin/behat --tags '~@first-run'
This will run all tests except for those with the first-run
tag.
Add writing tests documentation.