Skip to content

Commit 937761e

Browse files
committed
Edit php instructions to correspond with new php-unit alias
1 parent 443077e commit 937761e

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

_docs/developer/testing/php_unit_tests.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,41 @@ category: Developer > Development Instructions > Continuous Integration Testing
66
To validate the unit behavior of the site code, we utilize
77
[phpunit](https://phpunit.readthedocs.io/en/latest).
88

9-
### Dependencies
10-
11-
Before running PHP Unit Tests, you must install the required dependencies:
12-
13-
1. Install [Composer](https://getcomposer.org/download/) through the command-line installation copy-paste.
14-
2. `cd` to `/usr/local/submitty/GIT_CHECKOUT/Submitty/site/`.
15-
3. run `composer update`
16-
17-
*If tests are failing on main, you may need to run `apt install php-sqlite3`, especially if you haven't vagrant upped from scratch in a while.*
9+
*If tests are failing for you even on main, you may need to run `apt install php-sqlite3`, especially if you haven't vagrant upped from scratch in a while.*
1810

1911
### Running PHP Unit Tests
2012

2113
*If you are running on WSL and are seeing errors, remove `php` from the following commands.*
2214

23-
To run the PHP unit test suite locally, `cd` to `/usr/local/submitty/GIT_CHECKOUT/Submitty/site/` and type:
15+
To run the PHP unit test suite in VM use the alias
16+
17+
```
18+
submitty_test php-unit
19+
```
20+
21+
or
2422

2523
```
2624
sudo -u submitty_php php vendor/bin/phpunit
2725
```
2826

2927
To run just an individual class or test, you can use the `--filter` flag on PHPUnit.
3028
For example, to run the function `testInvalidProperty` would be
31-
`php vendor/bin/phpunit --filter testInvalidProperty` and running all
29+
`sudo -u submitty_php php vendor/bin/phpunit --filter testInvalidProperty` and running all
3230
of `AccessControlTester` would be
3331
`php vendor/bin/phpunit--filter AccessControlTester`. Be aware, filter
3432
can match against partial strings, so if you have two tests `testFoo` and `testFooBar`,
3533
running `--filter testFoo` will run them both. Alternatively, you can also directly run
3634
`phpunit` against a specific class by passing the path to the test class directly to
3735
`phpunit`, for example
38-
`php vendor/bin/phpunit tests/app/authentication/DatabaseAuthenticationTester.php` will run
36+
`sudo -u submitty_php php vendor/bin/phpunit tests/app/authentication/DatabaseAuthenticationTester.php` will run
3937
only the test methods in `DatabaseAuthenticationTester.php`.
4038

4139
The two concepts above can be combined to run a specific test function in a specific
4240
class by doing:
4341

4442
```bash
45-
vendor/bin/phpunit --filter testFunction tests/app/path/to/TestClass.php
43+
sudo -u submitty_php php vendor/bin/phpunit --filter testFunction tests/app/path/to/TestClass.php
4644
```
4745

4846
You can pass in the `--debug` flag when using PHPUnit to see PHP output, this can be

0 commit comments

Comments
 (0)