|
|
|
|
@ -39,7 +39,7 @@ class VerifyQccEnterprisePackInfoTest extends TestCase
|
|
|
|
|
DB::table('companies')->insert(['id' => 333, 'company_name' => '测试企业', 'credit_code' => 'test-credit']);
|
|
|
|
|
DB::table('company_qcc_accounts')->insert([
|
|
|
|
|
'company_id' => 333, 'status' => $status, 'first_success_ref' => 'original-ref',
|
|
|
|
|
'updated_at' => '2026-01-01 00:00:00',
|
|
|
|
|
'updated_at' => '2026-01-01 00:00:00', 'unknown_note' => '原有诊断备注',
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -64,6 +64,8 @@ class VerifyQccEnterprisePackInfoTest extends TestCase
|
|
|
|
|
return [
|
|
|
|
|
['selected', ['code' => 200, 'data' => ['news' => [['Title' => '<info>标题</info>']]]], [], 60, 0],
|
|
|
|
|
['occupied', ['code' => '200', 'data' => []], ['--timeout' => '120', '--raw' => true], 120, 0],
|
|
|
|
|
['unknown', ['code' => 200, 'data' => ['news' => []]], [], 60, 0],
|
|
|
|
|
['unknown', ['code' => 500], ['--timeout' => '120'], 120, 1],
|
|
|
|
|
['selected', ['code' => 0], [], 60, 1],
|
|
|
|
|
['occupied', ['code' => 500, 'msg' => '失败'], [], 60, 1],
|
|
|
|
|
['selected', ['data' => []], [], 60, 1],
|
|
|
|
|
@ -71,9 +73,9 @@ class VerifyQccEnterprisePackInfoTest extends TestCase
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @dataProvider exceptionCases */
|
|
|
|
|
public function test_exception_leaves_account_unchanged(?string $raw): void
|
|
|
|
|
public function test_exception_leaves_account_unchanged(string $status, ?string $raw): void
|
|
|
|
|
{
|
|
|
|
|
$this->company('selected');
|
|
|
|
|
$this->company($status);
|
|
|
|
|
$before = DB::table('company_qcc_accounts')->get()->toJson();
|
|
|
|
|
$mock = Mockery::mock(YuanheRepository::class);
|
|
|
|
|
$mock->shouldReceive('enterprisePackInfo')->once()->andThrow(new YuanhePackInfoException('请求超时', null, null, $raw));
|
|
|
|
|
@ -85,7 +87,7 @@ class VerifyQccEnterprisePackInfoTest extends TestCase
|
|
|
|
|
|
|
|
|
|
public static function exceptionCases(): array
|
|
|
|
|
{
|
|
|
|
|
return [[null], ['<html>Bad Gateway</html>']];
|
|
|
|
|
return [['selected', null], ['selected', '<html>Bad Gateway</html>'], ['unknown', null], ['unknown', '<html>Bad Gateway</html>']];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @dataProvider rejectedCases */
|
|
|
|
|
@ -102,7 +104,7 @@ class VerifyQccEnterprisePackInfoTest extends TestCase
|
|
|
|
|
public static function rejectedCases(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
['unknown', []], ['non_occupying', []], ['selected', ['--timeout' => '0']],
|
|
|
|
|
['none', []], ['non_occupying', []], ['selected', ['--timeout' => '0']],
|
|
|
|
|
['selected', ['--timeout' => '-1']], ['selected', ['--timeout' => '1.5']],
|
|
|
|
|
['selected', ['--timeout' => 'abc']],
|
|
|
|
|
];
|
|
|
|
|
|