Skip to content

Commit f511925

Browse files
Add non regression test
1 parent eb88670 commit f511925

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

tests/Rules/CallMethodsRuleTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Rules;
4+
5+
use PHPStan\Rules\Methods\CallMethodsRule;
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/data/bug-222.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Rules\data;
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+
20+
}

0 commit comments

Comments
 (0)