目前,我正在尝试在 Laravel 项目上使用 PHPUnit 运行一些简单的单元测试,命令行为 phpunit tests/Unit/ExampleTest。但它只运行第一个方法。有没有解决方案?谢谢!
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$this->assertTrue(true);
}
/**
* An other basic test
*
* @return void
*/
public function secondTestBasicTest()
{
$this->assertTrue(true);
}
public function basicTest(){
$response = $this->action('GET', 'DepartementsController@display', ['id' => 1]);
$view = $response->original;
$this->assertEquals(1, $view['$dpt->iddepartement']);
}
}