Skip to content

Fixes assertSame()/assertEquals() serialization errors running in separate processes.

License

Notifications You must be signed in to change notification settings

mpyw/phpunit-patch-serializable-comparison

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPUnit Patch Serializable Comparison Status

Fixes assertSame()/assertEquals() serialization errors running in separate processes.

Requirements

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'

About

Fixes assertSame()/assertEquals() serialization errors running in separate processes.

Topics

Resources

License

Stars

Watchers

Forks

Languages