maxfilatov / phpuaca

PHPUnit Autocomplete Assistant (PhpStorm plugin)
50 stars 24 forks source link

Add autocomplete for variables initialized in setUp() #15

Open patkoscsaba opened 8 years ago

patkoscsaba commented 8 years ago

Add autocomplete for class variables initialized in setUp() similar to the ones initialized in __construct().

Example:

class someTest extends .... {

private $var;

function setUp() { $this->var = new SomeClass(); }

function testSomething() { $this->var->[expect autocomplete here with the methods of SomeClass] } }

mdio commented 8 years ago

I'm doing the same right now, but with proper annotations:

class MyTest extends TestCase {
    /**
     * @var ObjectProphecy|MyOtherClass
     */
    private $otherClass;

    protected function setUp() {
        $this->otherClass = $this->prophesize(MyOtherClass::class);
    }

    public function testStuff() {
        $this->otherClass->someMethod()->willReturn(42);
    }
}

It still doesn't work. ->willReturn() is "not found in class MyOtherClass" by PhpStorm. Is it safe to assume that this will be implemented together with issue #9?

srosato commented 8 years ago

I am looking forward for this too