Skip to content

Commit 523e13c

Browse files
committed
Add a closure to the TestObjectCache
The closure prevents the object from getting serialized, which should not happen during tests, as the ObjectCache code path must not serialize the object. Signed-off-by: Sven Rautenberg <sven@rtbg.de>
1 parent d776470 commit 523e13c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/Pattern/TestAsset/TestObjectCache.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ final class TestObjectCache
2222
/** @var string */
2323
public $property = 'testProperty';
2424

25+
private \Closure $closure;
26+
27+
public function __construct()
28+
{
29+
// Closures prevent serialization - this acts as a detector to verify this object is not serialized during test.
30+
$this->closure = function () {};
31+
}
2532
public function bar(): string
2633
{
2734
++static::$fooCounter;

0 commit comments

Comments
 (0)