No autocomplete for test class field
overgapo opened this issue · 7 comments
overgapo commented
class A {
public function foo() {}
}
class FooTest extends \PHPUnit_Framework_TestCase
{
/** @var A|ObjectProphecy */
private $a;
protected function setUp(): void
{
$this->a = $this->prophesize(A::class);
}
public function testFoo(): void
{
// $this->a->foo()-> no autocomplete
$a = $this->prophesize(A::class);
$a->foo()->shouldBeCalledTimes(1); // /ok
}
}
jonnywilliamson commented
Just for info I have the same.
Deleted user commented
@overgapo, @jonnywilliamson: This works for me on the latest version (v2.2.1).
overgapo commented
@Hipio, try to get autocomplete for ->shouldBeCalledTimes(1)
method after $this->example->bar()
Deleted user commented
@overgapo You are correct, it does indeed not work, I retract my statement. It gives me two warning messages:
'void' method 'bar' result used
Method 'shouldBeCalledTimes' not found in void
scheb commented
Any update on this? I'm using plugin version 2.7 on PhpStorm 2017.2.4 and I have the same behavior that @overgapo showed above. Sadly this makes Prophecy quite hard to use when you want to create the unit-under-test and the mocks in the setUp method.
AlesZurek commented
Any update on this issue?
I have got the same problem.
I am storing mock to class property in setUp method like this
Haehnchen commented