You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.*
18
10
19
11
### Running PHP Unit Tests
20
12
21
13
*If you are running on WSL and are seeing errors, remove `php` from the following commands.*
22
14
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
24
22
25
23
```
26
24
sudo -u submitty_php php vendor/bin/phpunit
27
25
```
28
26
29
27
To run just an individual class or test, you can use the `--filter` flag on PHPUnit.
30
28
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
32
30
of `AccessControlTester` would be
33
31
`php vendor/bin/phpunit--filter AccessControlTester`. Be aware, filter
34
32
can match against partial strings, so if you have two tests `testFoo` and `testFooBar`,
35
33
running `--filter testFoo` will run them both. Alternatively, you can also directly run
36
34
`phpunit` against a specific class by passing the path to the test class directly to
37
35
`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
39
37
only the test methods in `DatabaseAuthenticationTester.php`.
40
38
41
39
The two concepts above can be combined to run a specific test function in a specific
0 commit comments