Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests
BSD-3-CLAUSE License
Bot releases are hidden (Show)
Published by jrfnl 6 months ago
Published by jrfnl about 1 year ago
Yoast\PHPUnitPolyfills\Polyfills\AssertObjectProperty
trait to polyfill the Assert::assertObjectHasProperty()
and Assert::assertObjectNotHasProperty()
methods as backported from PHPUnit 10.1.0 to PHPUnit 9.6.11. PR #135.Published by jrfnl over 1 year ago
This release updates the PHPUnit Polyfills to allow for "writing your tests for PHPUnit 10 and running them all the way back to PHPUnit 5".
Please keep in mind that the PHPUnit Polyfills provide forward-compatibility. This means that features which PHPUnit no longer supports in PHPUnit 10.x, like expecting PHP deprecation notices or warnings, are also no longer supported in the 2.0 release of the PHPUnit Polyfills.
Please refer to the PHPUnit 10 release notification and PHPUnit 10 changelog to inform your decision on whether or not to upgrade (yet).
Projects which don't use any of the new or removed functionality in their test suite, can, of course, use the PHPUnit Polyfills 1.x and 2.x series side-by-side, like so composer require --dev yoast/phpunit-polyfills:"^1.0 || ^2.0"
.
⚠️ Important: about the TestListener polyfill ⚠️
The TestListener polyfill in PHPUnit Polyfills 2.0 is not (yet) compatible with PHPUnit 10.0.0.
If you need the TestListener polyfill, it is recommended to stay on the PHPUnit Polyfills 1.x series for the time being and to watch the related ticket.
Yoast\PHPUnitPolyfills\Polyfills\AssertIgnoringLineEndings
trait to polyfill the Assert::assertStringEqualsStringIgnoringLineEndings()
and the Assert::assertStringContainsStringIgnoringLineEndings()
methods as introduced in PHPUnit 10.0.0. PR #109.Yoast\PHPUnitPolyfills\Polyfills\AssertIsList
trait to polyfill the Assert::assertIsList()
method as introduced in PHPUnit 10.0.0. PR #110.Yoast\PHPUnitPolyfills\Polyfills\AssertObjectProperty
trait to polyfill the Assert::assertObjectHasProperty()
and the Assert::assertObjectNotHasProperty()
methods as introduced in PHPUnit 10.1.0. PR #116.final
. This alignes them with the same change made upstream in PHPUnit 10.0.0. PR #104.Yoast\PHPUnitPolyfills\Polyfills\ExpectPHPException
trait. PR #108.Yoast\PHPUnitPolyfills\Polyfills\AssertNumericType
trait which is no longer needed now support for PHPUnit < 5.7 has been dropped. PR #102.Yoast\PHPUnitPolyfills\Polyfills\ExpectException
trait which is no longer needed now support for PHPUnit < 5.7 has been dropped. PR #102.Yoast\PHPUnitPolyfills\Polyfills\AssertFileDirectory
trait which is no longer needed now support for PHPUnit < 5.7 has been dropped. PR #102.Published by jrfnl over 1 year ago
$message
parameter passed to an assertion, will no longer overrule an emulated "assertion failed" message, but will be prefixed to it instead. PR #97assertIsClosedResource()
assertIsNotClosedResource()
assertIsReadable()
assertNotIsReadable()
assertIsWritable()
assertNotIsWritable()
assertDirectoryExists()
assertDirectoryNotExists()
assertStringNotContainsString()
assertStringNotContainsStringIgnoringCase()
develop
branch has been removed. Development will now take place in the 1.x
and 2.x
branches.Published by jrfnl almost 2 years ago
This is a maintenance release.
Yoast\PHPUnitPolyfills\Autoload
class is now final
. PR #77.Published by jrfnl almost 3 years ago
assertIsClosedResource()
and assertIsNotClosedResource()
assertions will now be more informative, most notably, when the value under test is a closed resource. PR #65, props Alain Schlesser for reporting.Published by jrfnl about 3 years ago
As of version 2.15.0 of the shivammathur/setup-php
action for GitHub Actions, the PHPUnit Polyfills can be installed directly from this action using the tools
key.
shivammathur/setup-php
action. PR #52
class_alias
for the PHPUnit_Runner_Version
or PHPUnit\Runner\Version
class. PR #59
Published by jrfnl about 3 years ago
Yoast\PHPUnitPolyfills\Autoload
class now contains a VERSION
constant. Issue #46, PR #47, props Pascal Birchler for the suggestion.Published by jrfnl over 3 years ago
Yoast\PHPUnitPolyfills\Polyfills\AssertClosedResource
trait to polyfill the Assert::assertIsClosedResource()
and Assert::assertIsNotClosedResource()
methods as introduced in PHPUnit 9.3.0. PR #27.Yoast\PHPUnitPolyfills\Polyfills\AssertObjectEquals
trait to polyfill the Assert::assertObjectEquals()
method as introduced in PHPUnit 9.4.0. PR #38.Yoast\PHPUnitPolyfills\Polyfills\EqualToSpecializations
trait to polyfill the Assert::equalToCanonicalizing()
, Assert::equalToIgnoringCase()
and Assert::equalToWithDelta()
methods as introduced in PHPUnit 9.0.0. PR #28, props Marc Siegrist.Error
and TypeError
classes as introduced in PHP 7.0. PR #36.XTestCase
: the visibility of the setUpFixtures()
and the tearDownFixtures()
methods has been changed to protected
(was public
). Issue #10, PR #20, props Mark Baker for reporting.AssertStringContainString
: PHPUnit < 6.4.2 would throw a "mb_strpos(): empty delimiter" PHP warning when the $needle
passed was an empty string. Props Gary Jones.Published by jrfnl almost 4 years ago
Yoast\PHPUnitPolyfills\TestListeners\TestListenerDefaultImplementation
: a cross-version compatible base implementation for TestListener
s using snake_case method names to replace the PHPUnit native method names.Yoast\PHPUnitPolyfills\Helpers\AssertAttributeHelper
trait containing a getProperty()
and a getPropertyValue()
method.assertAttribute*()
methods in PHPUnit 9.Yoast\PHPUnitPolyfills\Polyfills\AssertNumericType
trait to polyfill the Assert::assertFinite()
, Assert::assertInfinite()
and Assert::assertNan()
methods as introduced in PHPUnit 5.0.0.Yoast\PHPUnitPolyfills\Polyfills\ExpectException
trait to polyfill the TestCase::expectException()
, TestCase::expectExceptionMessage()
, TestCase::expectExceptionCode()
and TestCase::expectExceptionMessageRegExp()
methods, as introduced in PHPUnit 5.2.0 to replace the Testcase::setExpectedException()
and the Testcase::setExpectedExceptionRegExp()
method.Yoast\PHPUnitPolyfills\Polyfills\AssertFileDirectory
trait to polyfill the Assert::assertIsReadable()
, Assert::assertIsWritable()
methods and their file/directory based variations, as introduced in PHPUnit 5.6.0.Yoast\PHPUnitPolyfills\TestCases\TestCase
: support for the assertPreConditions()
and assertPostConditions()
methods.Published by jrfnl almost 4 years ago
Initial release