Skip to content

MicroUnit v1.0.0

Latest

Choose a tag to compare

@mitarnik04 mitarnik04 released this 23 Nov 09:17
· 6 commits to main since this release

A new way to test PHP. Built for today.

MicroUnit 1.0 is here, the first stable release after six betas. It is a substantial rewrite: tests you can read at a glance, zero dependencies, and runs fast enough that you never wait for them, with everything else you need in the box.

From this release on, MicroUnit follows semantic versioning: everything documented stays compatible throughout 1.x, and breaking changes wait for 2.0.

composer require --dev microunit/microunit
vendor/bin/microunit init
vendor/bin/microunit

Getting started · Documentation · Migrating from PHPUnit

Highlights

  • Tests that read like a description of behaviour. A test is a closure with a name that says what it checks, and assertions come in two styles that mix freely: static (Assert::exact(42, $answer)) or fluent (AssertString::begin($slug)->startsWith('post-')). See Writing tests, Assertions and Fluent assertions.
  • Zero dependencies. MicroUnit installs no Composer package, not even for its own development. Mocks, snapshots, code coverage, parallel runs and the Test Explorer are all built in.
  • Fast on real projects. Measured against PHPUnit on the test suites of six popular open-source projects, with the method, raw data and every exclusion published, so you can reproduce each number. See Benchmarks.
  • Works without setup, configurable in plain PHP. No config file is needed to start. When your project needs its own setup, one microunit.config.php with autocompletion holds test groups, parallel runs, coverage, reports, the Test Explorer and framework integration. See Configuration.
  • Easy to bring your tests along. microunit migrate translates PHPUnit suites, including mocks, data providers, base classes and expected exceptions, and leaves the originals untouched. See Migrating from PHPUnit.
  • Ready for AI coding agents. Compact JSON output with only the failures, an integrity check that catches tests weakened to pass, and an installable agent skill. See AI coding agents.

Also in the box

  • Test Explorer: a live view of your suite in the browser, with Visual Studio style run modes. See Test Explorer.
  • Code coverage in pure PHP, without Xdebug or PCOV: text, HTML, Clover and Cobertura reports and a minimum for CI. See Code coverage.
  • Built-in parallel runs that keep every suite together in one worker. See Parallel runs.
  • Mocks, stubs and spies with per-instance call logs, and snapshot testing that never creates snapshots by accident in CI. See Mocking and Snapshots.
  • Integration testing toolkit: fixtures with cleanup, a database helper, an HTTP server and client. See Integration testing.
  • Laravel, Symfony and CodeIgniter integrations. See Laravel, Symfony, CodeIgniter.
  • Reports: JUnit, HTML, GitHub Actions annotations, log files and JSON, several at once. See Output and reports.

Upgrading from the betas

1.0 changes some things the betas did differently. The ones you are most likely to notice:

  • PHP 8.5 or newer is required (was 8.0); PHP 8.6 is supported and tested.
  • Argument order follows PHPUnit everywhere: Assert::isGreaterThan($minimum, $actual) and Assert::isLessThan($maximum, $actual) swapped their arguments.
  • The command is vendor/bin/microunit; bin/run-tests.php remains as a shim.
  • Runtime files (logs, caches, Explorer state) live in .microunit/.

Every breaking change is listed under Changed (breaking) in the changelog.

Built with AI

1.0 was written with AI, and every change runs through MicroUnit's own suite on three operating systems and two PHP versions, static analysis, a coverage floor and an integrity check, and every release through the test suites of six real projects. Ensuring high quality with AI walks through the whole process, with links to check each step yourself.

Thank you

To everyone who tried the betas, reported issues and shared feedback: thank you.

Full changelog: CHANGELOG.md · v1.0.0-beta.6...v1.0.0