PHPUnit_Framework_TestCase找到但未定义的方法:: call()

Hi i am working with Laravel 4.2.17 , PHPUnit 5.1.1 and PHP 5.6.16 .

I am using PHPStorm as My Editor .

When i go to app/tests/ExampleTest.php and run it i am getting the error .

PHP Fatal error:  Class 'TestCase' not found in /..../app/tests/ExampleTest.php on line 3

Then i changed TestCase to PHPUnit_Framework_TestCase Now the ExampleTest.php looks like this

class ExampleTest extends PHPUnit_Framework_TestCase {

    /**
     * A basic functional test example.
     *
     * @return void
     */
    public function testBasicExample()
    {
        $crawler = $this->client->request('GET', '/');

        $this->assertTrue($this->client->getResponse()->isOk());
    }

}

Now the PHPUnit_Framework_TestCase calls is identified .

But when i try to do

public function testBasicExample()
{
    $this->call("POST","test");
}

It is saying that

Fatal error: Call to undefined method ExampleTest::call()

I checked the larval documents and in there

Calling A Route From A Test

You may easily call one of your routes for a test using the call method:

$response = $this->call('GET', 'user/profile');

$response = $this->call($method, $uri, $parameters, $files, $server, $content);

SO i am not sure what i am doing wrong .

I also tried by updating the composer , but no luck . :( :(

The reason you cannot access call is because you are no longer extending TestCase which provides it. I suggest you revert back to extends TestCase and run your tests again. You should make sure to run the test from the root directory by using phpunit app/tests.

Running composer dump-autoload also first, just in case it's an autoloading issue.