Skip to content

Commit 1a07095

Browse files
Add non regression test for #222
1 parent eb88670 commit 1a07095

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

phpstan-baseline.neon

+5
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ parameters:
1414
message: "#^Accessing PHPStan\\\\Rules\\\\Comparison\\\\ImpossibleCheckTypeMethodCallRule\\:\\:class is not covered by backward compatibility promise\\. The class might change in a minor PHPStan version\\.$#"
1515
count: 1
1616
path: tests/Rules/PHPUnit/ImpossibleCheckTypeMethodCallRuleTest.php
17+
18+
-
19+
message: "#^Accessing PHPStan\\\\Rules\\\\Methods\\\\CallMethodsRule\\:\\:class is not covered by backward compatibility promise\\. The class might change in a minor PHPStan version\\.$#"
20+
count: 1
21+
path: tests/Rules/Methods/CallMethodsRuleTest.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Rules\Methods;
4+
5+
use PHPStan\Rules\Rule;
6+
use PHPStan\Testing\RuleTestCase;
7+
8+
/**
9+
* @extends RuleTestCase<CallMethodsRule>
10+
*/
11+
class CallMethodsRuleTest extends RuleTestCase
12+
{
13+
14+
protected function getRule(): Rule
15+
{
16+
return self::getContainer()->getByType(CallMethodsRule::class);
17+
}
18+
19+
public function testBug222(): void
20+
{
21+
$this->analyse([__DIR__ . '/data/bug-222.php'], []);
22+
}
23+
24+
/**
25+
* @return string[]
26+
*/
27+
public static function getAdditionalConfigFiles(): array
28+
{
29+
return [
30+
__DIR__ . '/../../../extension.neon',
31+
];
32+
}
33+
34+
}

tests/Rules/Methods/data/bug-222.php

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Bug222;
4+
5+
use PHPUnit\Framework\MockObject\MockObject;
6+
use PHPUnit\Framework\TestCase;
7+
8+
class Foo extends TestCase
9+
{
10+
11+
public function doFoo(MockObject $mockService): void
12+
{
13+
$mockService
14+
->expects($this->exactly(1))
15+
->method('get')
16+
->with(24)
17+
->willReturn('24');
18+
19+
$mockService
20+
->method('get')
21+
->with(24)
22+
->willReturn('24');
23+
24+
$mockService
25+
->expects($this->exactly(1))
26+
->method('get')
27+
->willReturn('24');
28+
29+
$mockService
30+
->method('get')
31+
->willReturn('24');
32+
}
33+
34+
}

0 commit comments

Comments
 (0)