我想测试项目中特定的测试类,因为有很多测试类失败了,我只想每次测试一个类。
我已经在以下文件夹中创建了测试类\test\repositories\ApplicationVersionFormat.php
:
<?php
use App\Repositories\ApplicationVersionFormat;
class ApplicationVersionFormatTest extends \TestCase
{
public function testValidFormat()
{
$version = '1.2.3';
$appVersion = new ApplicationVersionFormat();
$this->assertEquals(true,$appVersion->isValidVersion($version));
}
public function testInvalidFormat()
{
$version = '11.2.3';
$appVersion = new ApplicationVersionFormat();
$this->assertEquals(false,$appVersion->isValidVersion($version));
}
public function testInvalidFormat2()
{
$version = '1.22.3';
$appVersion = new ApplicationVersionFormat();
$this->assertEquals(false,$appVersion->isValidVersion($version));
}
public function testInvalidFormat3()
{
$version = '1.2.33';
$appVersion = new ApplicationVersionFormat();
$this->assertEquals(false,$appVersion->isValidVersion($version));
}
public function testInvalidFormat4()
{
$version = '11.22.33';
$appVersion = new ApplicationVersionFormat();
$this->assertEquals(false,$appVersion->isValidVersion($version));
}
}
我尝试了以下命令,但没有一个有效:
phpunit "repositories\AppVersionTest"
。=> 无法打开文件“test/repositories/AppVersionTest.php”phpunit "test\repositories\AppVersionTest"
。=> 无法打开文件“test/repositories/AppVersionTest.php”phpunit --filter "repositories\AppVersionTest"
。=> 未执行任何测试!phpunit --testsuite "repositories\AppVersionTest"
。=> 未执行任何测试!
有人可以帮忙吗?谢谢。