https://github.com/deminy/test-doubles-explained
To explain test doubles in PHPUnit by using various examples.
https://github.com/deminy/test-doubles-explained
mocking php phpunit stubbing test-double test-doubles
Last synced: about 2 months ago
JSON representation
To explain test doubles in PHPUnit by using various examples.
- Host: GitHub
- URL: https://github.com/deminy/test-doubles-explained
- Owner: deminy
- License: other
- Created: 2023-08-03T16:17:05.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-05-06T23:59:22.000Z (12 months ago)
- Last Synced: 2025-01-24T07:08:41.057Z (3 months ago)
- Topics: mocking, php, phpunit, stubbing, test-double, test-doubles
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
**To explain [test doubles in PHPUnit] by using various examples.**
For details, please read the source code under folder [./unit] and run [the tests] using PHPUnit.
## Usage
First, run the following command to install/update Composer packages:
```bash
composer update -n
```Now we can run PHPUnit tests:
```bash
./vendor/bin/phpunit
```## Version Matrix
Following table shows the versions of PHP and PHPUnit used to run the tests of this project via GitHub Actions:
| PHP Versions | PHPUnit Versions |
|--------------|------------------|
| PHP 7.3 | PHPUnit 9 |
| PHP 7.4 | PHPUnit 9 |
| PHP 8.0 | PHPUnit 9 |
| PHP 8.1 | PHPUnit 10 |
| PHP 8.2 | PHPUnit 11 |
| PHP 8.3 | PHPUnit 11 |## References
* [test doubles in PHPUnit]: The official documentation.
* [StackOverflow: Mocks vs Stubs in PHPUnit]: Effective comparison of dummies, stubs, mocks, and spies in PHPUnit, although the examples are outdated.[test doubles in PHPUnit]: https://docs.phpunit.de/en/11.1/test-doubles.html
[StackOverflow: Mocks vs Stubs in PHPUnit]: https://stackoverflow.com/a/45975572
[./unit]: https://github.com/deminy/test-doubles-explained/tree/master/unit
[the tests]: https://github.com/deminy/test-doubles-explained/blob/master/unit/UnitTest.php