Releases: Yoast/PHPUnit-Polyfills
Releases · Yoast/PHPUnit-Polyfills
1.0.2
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.
Added
- README: FAQ section about installing and using the library via the
shivammathur/setup-phpaction. PR #52
Changed
- README: minor textual clarifications and improvements. PRs #52, #54, props Pierre Gordon.
- General housekeeping.
Fixed
- Autoloader: improved compatibility with packages which create a
class_aliasfor thePHPUnit_Runner_VersionorPHPUnit\Runner\Versionclass. PR #59
1.0.1
Added
- The
Yoast\PHPUnitPolyfills\Autoloadclass now contains aVERSIONconstant. Issue #46, PR #47, props Pascal Birchler for the suggestion.
This version constant can be used by (complex) test setups to verify that the PHPUnit Polyfills which will be loaded, comply with the version requirements for the test suite.
Changed
- Minor documentation updates. #43
1.0.0
Added
Yoast\PHPUnitPolyfills\Polyfills\AssertClosedResourcetrait to polyfill theAssert::assertIsClosedResource()andAssert::assertIsNotClosedResource()methods as introduced in PHPUnit 9.3.0. PR #27.Yoast\PHPUnitPolyfills\Polyfills\AssertObjectEqualstrait to polyfill theAssert::assertObjectEquals()method as introduced in PHPUnit 9.4.0. PR #38.
The behaviour of the polyfill closely matches the PHPUnit native implementation, but is not 100% the same.
Most notably, the polyfill will check the type of the returned value from the comparator method instead of enforcing a return type declaration for the comparator method.Yoast\PHPUnitPolyfills\Polyfills\EqualToSpecializationstrait to polyfill theAssert::equalToCanonicalizing(),Assert::equalToIgnoringCase()andAssert::equalToWithDelta()methods as introduced in PHPUnit 9.0.0. PR #28, props Marc Siegrist.- Polyfills for the PHP native
ErrorandTypeErrorclasses as introduced in PHP 7.0. PR #36. - README: FAQ section covering functionality removed from PHPUnit and usage with a Phar.
Changed
- The minimum supported PHP version has been lowered to PHP 5.4 (was 5.5). PR #19.
XTestCase: the visibility of thesetUpFixtures()and thetearDownFixtures()methods has been changed toprotected(waspublic). Issue #10, PR #20, props Mark Baker for reporting.- README: re-ordered the sections and various other improvements.
- Initial preparation for PHPUnit 10.0 compatibility.
- General housekeeping.
Fixed
- Issue #17 via PR #18 -
AssertStringContainString: PHPUnit < 6.4.2 would throw a "mb_strpos(): empty delimiter" PHP warning when the$needlepassed was an empty string. Props Gary Jones.
0.2.0
Added
Yoast\PHPUnitPolyfills\TestListeners\TestListenerDefaultImplementation: a cross-version compatible base implementation forTestListeners using snake_case method names to replace the PHPUnit native method names.Yoast\PHPUnitPolyfills\Helpers\AssertAttributeHelpertrait containing agetProperty()and agetPropertyValue()method.
This is a stop-gap solution for the removal of the PHPUnitassertAttribute*()methods in PHPUnit 9.
It is strongly recommended to refactor your tests/classes in a way that protected and private properties no longer be tested directly as they should be considered an implementation detail.
However, if for some reason the value of protected or private properties still needs to be tested, this helper can be used to get access to their value.Yoast\PHPUnitPolyfills\Polyfills\AssertNumericTypetrait to polyfill theAssert::assertFinite(),Assert::assertInfinite()andAssert::assertNan()methods as introduced in PHPUnit 5.0.0.Yoast\PHPUnitPolyfills\Polyfills\ExpectExceptiontrait to polyfill theTestCase::expectException(),TestCase::expectExceptionMessage(),TestCase::expectExceptionCode()andTestCase::expectExceptionMessageRegExp()methods, as introduced in PHPUnit 5.2.0 to replace theTestcase::setExpectedException()and theTestcase::setExpectedExceptionRegExp()method.Yoast\PHPUnitPolyfills\Polyfills\AssertFileDirectorytrait to polyfill theAssert::assertIsReadable(),Assert::assertIsWritable()methods and their file/directory based variations, as introduced in PHPUnit 5.6.0.Yoast\PHPUnitPolyfills\TestCases\TestCase: support for theassertPreConditions()andassertPostConditions()methods.
Changed
- The minimum supported PHP version has been lowered to PHP 5.5 (was 5.6).
- The minimum supported PHPUnit version has been lowered to PHP 4.8.36 (was 5.7).
Note: for PHPUnit 4, only version 4.8.36 is supported, for PHPUnit 5, only PHPUnit >= 5.7.21 is supported. - Readme: documentation improvements.