mpyw / phpunit-patch-serializable-comparison
Fixes assertSame/assertEquals serialization errors running in separate processes.
Installs: 163 940
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=5.3.3
- sebastian/comparator: ^1.0 || ^2.0 || ^3.0 || ^4.0 || ^5.0 || ^6.0
Requires (Dev)
- phpunit/phpunit: >=4.8
This package is auto-updated.
Last update: 2024-11-07 04:47:12 UTC
README
Fixes assertSame()
/assertEquals()
serialization errors running in separate processes.
Requirements
- php:
>=5.3.3
- phpunit/phpunit:
>=4.8.0
- sebastianbergmann/comparator:
^1.0 || ^2.0 || ^3.0 || ^4.0 || ^5.0 || ^6.0
Installing
composer require --dev mpyw/phpunit-patch-serializable-comparison
Example
class AssertionTest extends TestCase { protected function callAssertSameReceivingClosure(\Closure $closure) { static::assertSame('aaa', 'bbb'); } #[RunInSeparateProcess] #[PreserveGlobalState(enabled: false)] public function testAssertionIncludingUnserializableTrace() { static::callAssertSameInClosure(function () {}); } }
Before Patching
PHPUnit\Framework\Exception: PHP Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in Standard input code:XX
Stack trace:
#0 Standard input code(XX): serialize(Array)
#1 Standard input code(XX): __phpunit_run_isolated_test()
#2 {main}
thrown in Standard input code on line XX
After Patching
Failed asserting that two strings are identical. --- Expected +++ Actual @@ @@ -'aaa' +'bbb'