https://github.com/meetmatt/partial-mock
PHPUnit partial mock test lab
https://github.com/meetmatt/partial-mock
php phpunit
Last synced: 3 months ago
JSON representation
PHPUnit partial mock test lab
- Host: GitHub
- URL: https://github.com/meetmatt/partial-mock
- Owner: meetmatt
- License: mit
- Created: 2017-03-06T21:23:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-06T22:08:50.000Z (over 8 years ago)
- Last Synced: 2025-02-23T05:11:51.759Z (8 months ago)
- Topics: php, phpunit
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# PHPUnit partial mock test lab
## About
This is a test lab for PHPUnit's ability of partial mocks.
## Overview
A partial mock is simply a pattern to alleviate a specific problem in testing with mock objects, that of getting mock
objects into tight corners.
[This](test/UnitTest.php) test case validates PHPUnit's ability to do so.
[SUT](https://phpunit.de/manual/current/en/test-doubles.html) contains two methods, one of which needs to be tested.
However second method creates an unnecessary overhead for this test case and thus has to be mocked in order to isolate
the SUD from side-effects and to separate test case's concerns.
## Dependencies
This project requires following software:
- PHP ^5.6
- [Composer](https://getcomposer.org)
## Tested with
This project was tested with the following versions of software:
- PHP 7.0.13
- PHPUnit 5.7.15
## Installation
Installs composer dependencies:
```
$ composer install
```
## Usage
Run tests to verify PHPUnit features:
```
$ ./vendor/bin/phpunit --bootstrap vendor/autoload.php ./test
```
## Contribution
Feel free to send PR's, but I feel really sorry for you if you have nothing to do else.
Guidelines:
- PSR-4 for SUD classes under `Acme` namespace in [src](src) directory.
- PSR-4 for test case classes under `Acme\Test` namespace in [test](test) directory.
## License
Licensed under MIT License.