Codeception / Verify

BDD Assertions for PHPUnit and Codeception
MIT License
146 stars 25 forks source link

PHPStorm autocomplete doesn't work #22

Closed Jurigag closed 8 years ago

Jurigag commented 8 years ago

I added Verify,Specify and Codeception as my External Libraries to my project so i have auto complete in my tests.

when doing for example:

except($something)->

PHPStorm don't provide methods which are in Verify class. Same is happening with verify.

Jurigag commented 8 years ago

Also i dont get it. Sometimes it works, sometimes it doesn't.

jakim commented 8 years ago

/* @return Verify / verify($something)->

kt81 commented 8 years ago

I've got the same problem. using Intellij 2016.1 with PHP plugin. It seems like the PhpStorm's bug?

class Test extends PHPUnit_Framework_TestCase
{
    /**
     * @return \Codeception\Verify
     */
    protected function verify()
    {
        return verify(...func_get_args());
    }

    public function testMe()
    {
        $a = 1;

        // auto complition does not work
        verify('test', $a)->equals(1);

        // this works. i don't know why it works only such this case.
        verify($a)->equals(1);

        // when same function declared inside some class, it works.
        $this->verify('test', $a)->equals(1);
    }
}
Jurigag commented 8 years ago

It is supposed to work on 162.917 phpstorm build(2016.2). Can someone check it ? https://youtrack.jetbrains.com/issue/WI-32230#comment=27-1481399

@kt81

kt81 commented 8 years ago

@Jurigag First, I don't know it could help your case, I figured out a very simple solution. Add \ before verify() and expect(), or delete testcase's namespace, then autocompletion works fine.


Anyway, the problem has still occurred in v162.917.12. I found that it was more complicated problem than I had expected...

I made a new clean Laravel project with verify and created a simple test class.

<?php
namespace test;

class Test extends \PHPUnit_Framework_TestCase
{
    protected function testA()
    {
        $a = 1;
        verify('\( ‘ω’)/ウオオアアアアアアアアアーッッッッッッ!!', $a)->equals(1);
    }
}

In this case, autocomplete has worked correctly. Then I simply coppied this code to my project that has the autocomplete problem. However, autocomplete has not worked. (and a inspection warning occurred as usual...) I think this problem is related by other libraries but I couldn't figure out the causes.

kt81 commented 8 years ago

@Jurigag It seems to be fixed in IntelliJ IDEA 2016.2.

Jurigag commented 8 years ago

Well i will check it later, thanks for info.