PMVC Test Framework

0.4.6 2023-09-08 07:55 UTC

This package is auto-updated.

Last update: 2024-04-08 14:41:55 UTC


README

Latest Stable Version Latest Unstable Version CircleCI License Total Downloads

A simple phpunit wrapper let it support phpunt 4.8.35, 6.5.5, 9.5.0

In another word.

You could use is cross php version 5.5 -> 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

$path = __DIR__ . '/../vendor/autoload.php';
include $path;

\PMVC\Load::plug(
    ['unit' => null],
    [__DIR__ . '/../../']
);

Php TestCase code example

<?php

namespace PMVC\PlugIn\hell_world;

use PMVC\TestCase;

class HelloWorldTest extends TestCase
{

}

CI config example

PHPUnit Tip

  • Show event
phpunit --log-events-text php://stdout
  • show deprecations
phpunit --display-deprecations --testdox

Install with Composer

1. Download composer

2. Install by composer.json or use command-line directly

2.1 Install by composer.json

  • vim composer.json
{
    "require": {
        "pmvc-plugin/unit": "dev-master"
    }
}
  • 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