https://github.com/pmvc-plugin/unit
https://github.com/pmvc-plugin/unit
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/pmvc-plugin/unit
- Owner: pmvc-plugin
- Created: 2021-03-31T20:10:12.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2026-03-21T10:25:57.000Z (2 months ago)
- Last Synced: 2026-04-29T01:09:23.614Z (about 1 month ago)
- Language: PHP
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://packagist.org/packages/pmvc-plugin/unit)
[](https://packagist.org/packages/pmvc-plugin/unit)
[](https://circleci.com/gh/pmvc-plugin/unit/tree/main)
[](https://packagist.org/packages/pmvc-plugin/unit)
[](https://packagist.org/packages/pmvc-plugin/unit)
A simple phpunit wrapper let it support phpunit 4.8.36, 8.5.52, ^9.6, ^10.5, ^11.5
===============
## In another word.
You could use is cross php version 5.6 -> 8.x+
## function mapping table
phpunit | PMVC/unit
--------------------------|----------
__construct | pmvc_init
setup | pmvc_setup
teardown | pmvc_teardown
assertContains | haveString
assertStringContainsString| haveString
assertStringContainsString| haveString
getMockBuilder | getPMVCMockBuilder
setMethods | pmvc_onlyMethods
onlyMethods | pmvc_onlyMethods
## Code example
### tests/include.php example
```php
null],
[__DIR__ . '/../../']
);
```
### Php TestCase code example
```php
dump(/*anything*/); //fwrite(STDERR, print_r(?, true));
```
* trigger PMVC dev dump
* https://github.com/pmvc-plugin/dev/blob/main/tests/DevWithPhpUnitTest.php
* Further integration with the [dev] plugin.
* https://github.com/pmvc-plugin/dev#debug-with-cli
```php
\PMVC\plug('dev')->debug_with_cli();
\PMVC\d(/*something*/);
```
## Install with Composer
### 1. Download composer
* mkdir test_folder
* curl -sS https://getcomposer.org/installer | php
### 2. Install by composer.json or use command-line directly
#### 2.1 Install by composer.json
* vim composer.json
```json
{
"require": {
"pmvc-plugin/unit": "dev-main"
}
}
```
* php composer.phar install
#### 2.2 Or use composer command-line
* php composer.phar require pmvc-plugin/unit
* or
* composer require pmvc-plugin/unit
## Other Polyfills
* https://github.com/Yoast/PHPUnit-Polyfills