This commit is contained in:
2025-09-13 01:22:15 +08:00
parent 155e05fd6d
commit 1a4b8551a0
674 changed files with 146276 additions and 0 deletions

View File

@ -0,0 +1,59 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/9 12:25
* @Description
*
*/
namespace Application\Command;
use Application\Service\Extension\Helper\ArrayHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use function Co\run;
class UnitTestCommand extends BasicCommand
{
/**
* 脚本描述.
* @var string
*/
protected static $defaultDescription = '运行单元测试实例。';
protected function configure()
{
$this
->addArgument(
'files',
InputArgument::IS_ARRAY
)
;
}
public function execute(InputInterface $input, OutputInterface $output)
{
$updateFiles = $input->getArguments();
run(function() use ($updateFiles) {
// $ret = \Swoole\Coroutine\System::exec("/usr/bin/php vendor/bin/phpunit module/Application/test/model --coverage-html report");
$unitTestFiles = [
'phpunit.xml.dist',
'module/Application/test/model/BaseTestUnit.php',
'module/Application/test/model/DictionaryFormTest.php',
'module/Application/test/model/HelperTest.php',
'module/Application/test/model/PatientFormTest.php',
'module/Application/test/model/PatientModelTest.php',
];
$file = implode(' ', ArrayHelper::merge($unitTestFiles, $updateFiles['files']));
$ret = \Swoole\Coroutine\System::exec("git fetch && git checkout origin/develop {$file} && /usr/bin/php vendor/bin/phpunit");
echo $ret['output'];
});
return 0;
}
}