5dd6cc63944e638019d925a92974b293254f3afd
[yaffs-website] / web / core / tests / README.md
1 # Running tests
2
3 ## Functional tests
4
5 * Start PhantomJS:
6   ```
7   phantomjs --ssl-protocol=any --ignore-ssl-errors=true ./vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null &
8   ```
9 * Run the functional tests:
10   ```
11   export SIMPLETEST_DB='mysql://root@localhost/dev_d8'
12   export SIMPLETEST_BASE_URL='http://d8.dev'
13   ./vendor/bin/phpunit -c core --testsuite functional
14   ./vendor/bin/phpunit -c core --testsuite functional-javascript
15   ```
16
17 Note: functional tests have to be invoked with a user in the same group as the
18 web server user. You can either configure Apache (or nginx) to run as your own
19 system user or run tests as a privileged user instead.
20
21 To develop locally, a straightforward - but also less secure - approach is to
22 run tests as your own system user. To achieve that, change the default Apache
23 user to run as your system user. Typically, you'd need to modify
24 `/etc/apache2/envvars` on Linux or `/etc/apache2/httpd.conf` on Mac.
25
26 Example for Linux:
27
28 ```
29 export APACHE_RUN_USER=<your-user>
30 export APACHE_RUN_GROUP=<your-group>
31 ```
32
33 Example for Mac:
34
35 ```
36 User <your-user>
37 Group <your-group>
38 ```
39
40 If the default user is e.g. `www-data`, the above functional tests will have to
41 be invoked with sudo instead:
42
43 ```
44 export SIMPLETEST_DB='mysql://root@localhost/dev_d8'
45 export SIMPLETEST_BASE_URL='http://d8.dev'
46 sudo -u www-data -E ./vendor/bin/phpunit -c core --testsuite functional
47 sudo -u www-data -E ./vendor/bin/phpunit -c core --testsuite functional-javascript
48 ```