Skip to content

Commit aef0f9a

Browse files
authored
Merge pull request #14 from Roave/feature/ensure-no-leaks-from-prophecy-mocks
Verify that Prophecy mocks don't leak
2 parents 83c0913 + e47c1e9 commit aef0f9a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/e2e/LeakyIntegrationTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ public function doesLeakATinyAmountOfMemory(): void
4747
$this->addToAssertionCount(1);
4848
}
4949

50+
/** @test */
51+
public function doesNotLeakGarbageCollectedMocks(): void
52+
{
53+
$this->createMock(stdClass::class);
54+
55+
$this->addToAssertionCount(1);
56+
}
57+
58+
/** @test */
59+
public function doesNotLeakGarbageCollectedProphecyMocks(): void
60+
{
61+
LeakyStaticObject::leak($this->prophesize(stdClass::class));
62+
63+
$this->addToAssertionCount(1);
64+
}
65+
5066
/** @test */
5167
public function doesLeakAMock(): void
5268
{
@@ -55,6 +71,14 @@ public function doesLeakAMock(): void
5571
$this->addToAssertionCount(1);
5672
}
5773

74+
/** @test */
75+
public function doesLeakAProphecyMock(): void
76+
{
77+
LeakyStaticObject::leak($this->prophesize(stdClass::class));
78+
79+
$this->addToAssertionCount(1);
80+
}
81+
5882
/** @test */
5983
public function doesLeakOneObject(): void
6084
{

0 commit comments

Comments
 (0)