I have single test

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

that fails with Symfony\Component\HttpKernel\Exception\NotFoundHttpException when I run

phpunit

from commandline in project dir and I have phpunit.xml (from laravel) in project dir

BUT when I run tests from Netbeans - it passes.

I copied Netbeans output command to commandline

phpunit "C:\Program Files\NetBeans 8.0\php\phpunit\NetBeansSuite.php" "--run=C:\Program Files (x86)\wamp\www\platform\workbench\neyl\customers\tests;C:\Program Files (x86)\wamp\www\platform\app\tests"

and it also works!

So, test works when being called from NetbeansSuite.php but not from regular commandline. Even

phpunit MyTest.php

fails

How can this be? What factor is diiferent when using PHPUnit_Framework_TestSuite than regular cli?

有帮助吗?

解决方案

Ok. The discrepancy was caused by order tests were called. phpunit from cli uses testsuites from phpunit.xml but the netbeans tests don't use the phpunit.xml for testsuites so they were called in order netbeans was calling them

Now I have to work out what the order of testclasses is causing!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top