The most broadly extended class of PHPUnit is \PHPUnit\Framework\TestCase
As PHPUnit evolved over the years, functionality has been added, deprecated and removed
This document tries to deliver an exhaustive list of which version a specific feature has been added or removed.
The main motivation behind this is make it easier to create test-code that is compattible across various PHPUnit versions.
PHPUnit | Supported Until | Status | 7.2 | 7.3 | 7.4 | 8.0 |
---|---|---|---|---|---|---|
v9.5 |
2022 | current | ✔ | ✔ | ✔ | |
v8.5 |
2021 | previous | ✔ | ✔ | ✔ |
For full version compatibility see this Version compatibility Gist for details.
Class | Added | Deprecated | Removed |
---|---|---|---|
PHPUnit_Framework_TestCase |
2.0 |
- |
6.0 |
PHPUnit\Framework\TestCase |
4.8 /5.4 |
- |
- |
Function | Added |
---|---|
TestCase::assertDirectoryExists |
5.6 |
TestCase::assertDirectoryIsReadable |
5.6 |
TestCase::assertDirectoryIsWritable |
5.6 |
TestCase::assertDirectoryNotExists |
5.6 |
TestCase::assertDirectoryNotIsReadable |
5.6 |
TestCase::assertDirectoryNotIsWritable |
5.6 |
TestCase::assertFileIsReadable |
5.6 |
TestCase::assertFileIsWritable |
5.6 |
TestCase::assertFileNotIsReadable |
5.6 |
TestCase::assertFileNotIsWritable |
5.6 |
TestCase::assertFinite |
5.0 |
TestCase::assertInfinite |
5.0 |
TestCase::assertIsReadable |
5.6 |
TestCase::assertIsWritable |
5.6 |
TestCase::assertNan |
5.0 |
TestCase::assertNotIsReadable |
5.6 |
TestCase::assertNotIsWritable |
5.6 |
TestCase::createConfiguredMock |
5.6 |
TestCase::createMock |
5.4 |
TestCase::createPartialMock |
5.5 |
TestCase::createTestProxy |
6.0 |
TestCase::expectException |
5.2 |
TestCase::expectExceptionCode |
5.2 |
TestCase::expectExceptionMessage |
5.2 |
TestCase::expectExceptionMessageRegExp |
5.2 |
TestCase::expectExceptionObject |
6.4 |
TestCase::expectNotToPerformAssertions |
7.2 |
TestCase::getExpectedExceptionCode |
6.0 |
TestCase::getExpectedExceptionMessage |
6.0 |
TestCase::registerComparator |
6.4 |
Function | Added | Deprecated | Removed |
---|---|---|---|
TestCase::assertNotTag() |
3.3 |
4.2 |
5.0 |
TestCase::assertSelectCount() |
3.3 |
4.2 |
5.0 |
TestCase::assertSelectEquals() |
3.3 |
4.2 |
5.0 |
TestCase::assertSelectRegExp() |
3.3 |
4.2 |
5.0 |
TestCase::assertTag() |
3.3 |
4.2 |
5.0 |
TestCase::getMock |
3.0 |
5.4 |
6.0 |
TestCase::getMockObjectGenerator (1) |
4.1 |
- |
6.0 |
TestCase::getMockWithoutInvokingTheOriginalConstructor |
5.0 |
5.4 |
6.0 |
TestCase::hasPerformedExpectationsOnOutput |
3.6 |
4.3 |
6.0 |
TestCase::setExpectedException |
3.2 |
5.2 |
6.0 |
TestCase::setExpectedExceptionRegExp |
4.3 |
5.6 |
6.0 |
(1) Visibility changed from protected
to private
Function | Added |
---|---|
@requires OS |
4.0 |
Support for extension version | 5.2 |
Support for comparison operators | 5.3 |
Support for Composer-style version constraints | 6.1 |
@requires OSFAMILY |
6.3 |