Skip to content

Commit 9bd00f9

Browse files
committed
Do not isolate
1 parent 4e12ccf commit 9bd00f9

File tree

3 files changed

+59
-8
lines changed

3 files changed

+59
-8
lines changed

tests/Mockery/Foo2.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Mockery;
4+
5+
class Foo2 implements Baz
6+
{
7+
8+
/** @var bool */
9+
private $optional;
10+
11+
public function __construct(bool $optional = true)
12+
{
13+
$this->optional = $optional;
14+
}
15+
16+
public function doFoo(): ?string
17+
{
18+
if ($this->optional) {
19+
return null;
20+
}
21+
22+
return 'foo';
23+
}
24+
25+
}

tests/Mockery/Foo3.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Mockery;
4+
5+
class Foo3 implements Baz
6+
{
7+
8+
/** @var bool */
9+
private $optional;
10+
11+
public function __construct(bool $optional = true)
12+
{
13+
$this->optional = $optional;
14+
}
15+
16+
public function doFoo(): ?string
17+
{
18+
if ($this->optional) {
19+
return null;
20+
}
21+
22+
return 'foo';
23+
}
24+
25+
}

tests/Mockery/IsolatedMockeryTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,32 @@
22

33
namespace PHPStan\Mockery;
44

5-
/**
6-
* @runTestsInSeparateProcesses
7-
*/
85
class IsolatedMockeryTest extends \PHPUnit\Framework\TestCase
96
{
107

118
public function testAliasMock(): void
129
{
13-
$fooMock = \Mockery::mock('alias:' . Foo::class);
14-
$this->requireFoo($fooMock);
10+
$fooMock = \Mockery::mock('alias:' . Foo2::class);
11+
$this->requireFoo2($fooMock);
1512

1613
$fooMock->shouldReceive('doFoo')->andReturn('bar');
1714
self::assertSame('bar', $fooMock->doFoo());
1815
}
1916

2017
public function testOverloadMock(): void
2118
{
22-
$fooMock = \Mockery::mock('overload:' . Foo::class);
23-
$this->requireFoo($fooMock);
19+
$fooMock = \Mockery::mock('overload:' . Foo3::class);
20+
$this->requireFoo3($fooMock);
2421

2522
$fooMock->shouldReceive('doFoo')->andReturn('bar');
2623
self::assertSame('bar', $fooMock->doFoo());
2724
}
2825

29-
private function requireFoo(Foo $foo): void
26+
private function requireFoo2(Foo2 $foo): void
27+
{
28+
}
29+
30+
private function requireFoo3(Foo3 $foo): void
3031
{
3132
}
3233

0 commit comments

Comments
 (0)