Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion _docs/developer/testing/install_php.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ you will need to have PHP installed on your host machine first.

### Linux & WSL:

*If you're distro cannot find the correct package or installs the wrong version you may have to specify php7.0 in each package name*
*If you're distro cannot find the correct package or installs the wrong version you may have to specify php8.1 in each package name*

```bash
sudo apt-get update
Expand All @@ -23,6 +23,10 @@ If you are missing extensions you can install them with `PECL` which will be
installed automatically with PHP, but you should have everything required by
default.

### Windows

Download [php 8.1](https://windows.php.net/download/) as a zip file under the thread safe category. Then extract the contents of the zip to a folder, and add the path to that folder to your path system variable. It's suggested that one extracts the contents of the zip to a folder called `php`, which can be put at `C:\php` for simplicity. You can then add `C:\php` to your path system environment variable.

-------------

Verify you have PHP installed correctly, submitty requires a version greater than 7.0
Expand Down
2 changes: 1 addition & 1 deletion _docs/developer/testing/linting_static_analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The following instructions were tested for Windows:

1. First, you will need PHP installed on your host system first. See [Installing PHP](/developer/testing/install_php)*

2. Next, you will need [Composer](https://getcomposer.org/doc/00-intro.md) installed on your host system as well.
2. Next, you will need [Composer](https://getcomposer.org/download/) installed on your host system as well.
During this install, you will need to change settings in a php.ini file. Change the settings the prompt recommends.

3. Run ``composer global require slevomat/coding-standard`` and ``composer global require "squizlabs/php_codesniffer=*"`` inside your terminal.
Expand Down
18 changes: 11 additions & 7 deletions _docs/developer/testing/php_unit_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,37 @@ To validate the unit behavior of the site code, we utilize

### Running PHP Unit Tests

*You will need PHP installed on your host system first, see [Installing PHP](/developer/testing/install_php)*
*If you are running on WSL and are seeing errors, remove `php` from the following commands.*

To run the PHP unit test suite locally, `cd` to the `Submitty/site` directory and type:
To run the PHP unit test suite in VM use the alias

If you are running on WSL and are seeing errors, remove "`php`" from the following commands.
```
submitty_test php-unit
```

or

```
php vendor/bin/phpunit
sudo -u submitty_php php vendor/bin/phpunit
```

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

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

```bash
vendor/bin/phpunit --filter testFunction tests/app/path/to/TestClass.php
sudo -u submitty_php php vendor/bin/phpunit --filter testFunction tests/app/path/to/TestClass.php
```

You can pass in the `--debug` flag when using PHPUnit to see PHP output, this can be
Expand Down
4 changes: 2 additions & 2 deletions _docs/sysadmin/installation/version_notes/v20.08.00.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ requires the following edits:

1. Locate your `php.ini` file.

_It is probably something like `/etc/php/7.2/fpm/php.ini`._
_It is probably something like `/etc/php/8.1/fpm/php.ini`._

Note: You can run this command to print your specific version of php:

Expand All @@ -32,7 +32,7 @@ requires the following edits:
3. Restart php fpm:

```
sudo systemctl restart php7.2-fpm
sudo systemctl restart php8.1-fpm
```

Or more generally:
Expand Down
Loading