feat: 添加手机号状态测试用例,优化测试逻辑

This commit is contained in:
lingling 2025-03-18 21:48:17 +08:00
parent 62ccfb43d0
commit cae91857d1
2 changed files with 41 additions and 0 deletions

View File

@ -1,5 +1,7 @@
<?php
namespace Tests;
use App\Utils\API\Rocketgo;
use PHPUnit\Framework\TestCase;
class TestConfig extends TestCase
@ -31,4 +33,11 @@ class TestConfig extends TestCase
'one plus one' => [1, 1, 2], // 1 + 1 = 2 pass
];
}
public function testPhone()
{
$res=Rocketgo::get_ws_status(8801831892829);
// $this->assertSame($expected, $a + $b);
$this->assertEquals(0,0);
}
}

32
tests/TestPhone.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace Tests;
use App\Utils\API\Rocketgo;
use PHPUnit\Framework\TestCase;
/**
* 用户手机号测试类
*/
class TestPhone extends TestCase
{
/**
* @dataProvider additionPhone
*/
public function testPhone($phone, $expected)
{
Rocketgo::test_login();
$res = Rocketgo::get_ws_status($phone);
$this->assertEquals($expected, $res);
}
public function additionPhone()
{
$phone_array = [];
$phone = 8801837967987;
$phone_array["在列表ws号"] = [$phone, 0];
$phone_array["不在列表ws号"] = [8801837967986, 1];
for ($i = 1; $i <= 20; $i++) {
$phone_array["查询第 $i 次在列表ws号 $phone"] = [$phone, 0];
}
return $phone_array;
}
}