An open API service indexing awesome lists of open source software.

https://github.com/pmvc-plugin/unit


https://github.com/pmvc-plugin/unit

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

          

[![Latest Stable Version](https://poser.pugx.org/pmvc-plugin/unit/v/stable)](https://packagist.org/packages/pmvc-plugin/unit)
[![Latest Unstable Version](https://poser.pugx.org/pmvc-plugin/unit/v/unstable)](https://packagist.org/packages/pmvc-plugin/unit)
[![CircleCI](https://circleci.com/gh/pmvc-plugin/unit/tree/main.svg?style=svg)](https://circleci.com/gh/pmvc-plugin/unit/tree/main)
[![License](https://poser.pugx.org/pmvc-plugin/unit/license)](https://packagist.org/packages/pmvc-plugin/unit)
[![Total Downloads](https://poser.pugx.org/pmvc-plugin/unit/downloads)](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