PHPackages                             webimpress/phpunit-migration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. webimpress/phpunit-migration

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

webimpress/phpunit-migration
============================

Migrate your tests to the newest PHPUnit version

1142[2 PRs](https://github.com/webimpress/phpunit-migration/pulls)PHP

Since Apr 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/webimpress/phpunit-migration)[ Packagist](https://packagist.org/packages/webimpress/phpunit-migration)[ RSS](/packages/webimpress-phpunit-migration/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/7f1f4156347a9852c4c336c668066b2090ba4557aa69d36b6988218184209eba/68747470733a2f2f7472617669732d63692e636f6d2f776562696d70726573732f706870756e69742d6d6967726174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/webimpress/phpunit-migration)[![Coverage Status](https://camo.githubusercontent.com/eda718e4669d82a72c69f77d069f1cde11816c21fa8cd7d97541bc2c34eefa32/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f776562696d70726573732f706870756e69742d6d6967726174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/webimpress/phpunit-migration?branch=master)

PHPUnit migration tool
======================

[](#phpunit-migration-tool)

Migrate project to the newest version of PHPUnit.

**\[Work In Progress\] Use it on the own risk :)**

How to use the tool?
--------------------

[](#how-to-use-the-tool)

Clone the project:

```
$ git clone https://github.com/webimpress/phpunit-migration.git
```

Go into the directory and install dependencies:

```
$ cd phpunit-migration
$ composer install
```

To update your project to the newest version of PHPUnit go to your project directory and run:

```
$ ../path/to/phpunit-migration/bin/phpunit-migration migrate
```

What the tool is changing?
--------------------------

[](#what-the-tool-is-changing)

1. compose dependencies to the latest PHPUnit versions,
2. `\PHPUnit_Framework_TestCase` to namespaced `\PHPUnit\Framework\TestCase`,
3. `setExpectedException` to `expectException*`,
4. `setUp` and `tearDown` to `protected` and correct case (`setup` =&gt; `setUp` etc.),
5. FQCN in `@cover` tag (i.e. `@covers MyClass` to `@covers \MyClass`),
6. `assertInternalType` and `assertNotInternalType` to more specific assertion method (PHPUnit 7.5+),
7. `getMock` to `getMockBuilder` with other required function calls (PHPUnit 5.4+),
8. `getMockBuilder(...)->...->getMock()` to `createMock(...)` if possible (PHPUnit 5.4+),
9. `assertEquals()` and `assertNotEquals()` with `$delta`, `$maxDepth`, `$canonicalize` and `$ignoreCase`parameters to more specific assertion method (PHPUnit 7.5+),
10. add void return type to the following methods: `setUp()`, `tearDown()`, `setUpBeforeClass()`, `tearDownAfterClass()`, `assertPreConditions()`, `assertPostConditions()`, `onNotSuccessfulTest(\Throwable $th)` (PHPUnit 8.0+),
11. `expectExceptionMessageRegExp` to `expectExceptionMessageMatches` (PHPUnit 8.4+),
12. use new (more readable) assertion names:

- `assertNotIsReadable` replaced by `assertIsNotReadable'`,
- `assertNotIsWritable` replaced by `assertIsNotWritable'`,
- `assertDirectoryNotExists` replaced by `assertDirectoryDoesNotExist'`,
- `assertDirectoryNotIsReadable` replaced by `assertDirectoryIsNotReadable'`,
- `assertDirectoryNotIsWritable` replaced by `assertDirectoryIsNotWritable'`,
- `assertFileNotExists` replaced by `assertFileDoesNotExist'`,
- `assertFileNotIsReadable` replaced by `assertFileIsNotReadable'`,
- `assertFileNotIsWritable` replaced by `assertFileIsNotWritable'`,
- `assertRegExp` replaced by `assertMatchesRegularExpression'`,
- `assertNotRegExp` replaced by `assertDoesNotMatchRegularExpression'`. (PHPUnit 9.1+),

13. TODO: `getMockBuilder(...)->...->setMethods(...)->getMock()` to `createPartialMock(...)` if possible (PHPUnit 5.5.3+),
14. TODO: `assertContains()` and `assertNotContains()` on `string` haystack to more specific assertion method (PHPUnit 7.5+),
15. TODO: `$this->assert` to `self::assert`.

What the tool is NOT doing?
---------------------------

[](#what-the-tool-is-not-doing)

1. changing `PHPUnit_Framework_Error_*` classes
2. probably other things I don't remember now ;-)

> ### Note
>
> [](#note)
>
> Please remember it is developer tool and it should be used only as a helper to migrate your tests to newer version of PHPUnit. Always after migration run all your test to verify if applied changes are right and your tests are still working!

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 61.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/06864e2afad0a0cb0b46016664bf5895c3378c8b413e0bddd03075011fc6d731?d=identicon)[webimpress](/maintainers/webimpress)

---

Top Contributors

[![michalbundyra](https://avatars.githubusercontent.com/u/7423207?v=4)](https://github.com/michalbundyra "michalbundyra (100 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (63 commits)")

---

Tags

phpunitphpunit-migration

### Embed Badge

![Health badge](/badges/webimpress-phpunit-migration/health.svg)

```
[![Health](https://phpackages.com/badges/webimpress-phpunit-migration/health.svg)](https://phpackages.com/packages/webimpress-phpunit-migration)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14228.7M341](/packages/dms-phpunit-arraysubset-asserts)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8011.5k2](/packages/phpbenchmark-phpbenchmark)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
