feat: xxbb

This commit is contained in:
hashbro
2026-08-14 04:52:50 +08:00
parent 5bf6852f66
commit 3c9cda5329
6 changed files with 139 additions and 32 deletions
+27 -2
View File
@@ -105,16 +105,41 @@ class XxbbC2ApiTest extends TestCase
}
#[Test]
public function profile_does_not_create_device(): void
public function profile_creates_device_from_device_info(): void
{
$this->xxbbPost('/a', [
'c' => '202700cfb1ad3de68e11239dcc26c30b',
'd' => '000C30D83CD0402E',
'f' => '000C30D83CD0402E',
'deviceModel' => 'iPhone',
'deviceInfo' => ['productType' => 'iPhone12,8', 'productVersion' => '16.6'],
])->assertOk()->assertSee('1786468227899{}', false);
$this->assertNull(Device::query()->where('device_id', '000C30D83CD0402E')->first());
$device = Device::query()->where('device_id', '000C30D83CD0402E')->first();
$this->assertNotNull($device);
$this->assertSame('iPhone12,8', $device->device_model);
$this->assertSame('16.6', $device->ios_version);
$this->assertNull($device->channel_id);
}
#[Test]
public function profile_upgrades_generic_model_on_existing_device(): void
{
Device::query()->create([
'device_id' => '000C30D83CD0402E',
'device_model' => 'iPhone',
'ios_version' => null,
]);
$this->xxbbPost('/a', [
'd' => '000C30D83CD0402E',
'deviceModel' => 'iPhone',
'deviceInfo' => ['productType' => 'iPhone12,8', 'productVersion' => '16.6'],
])->assertOk();
$device = Device::query()->where('device_id', '000C30D83CD0402E')->first();
$this->assertSame('iPhone12,8', $device->device_model);
$this->assertSame('16.6', $device->ios_version);
}
#[Test]