feat: alchemy

This commit is contained in:
hashbro
2026-09-29 05:25:55 +08:00
parent 2c87d37051
commit 15c45a4fd2
14 changed files with 871 additions and 24 deletions
+36 -2
View File
@@ -367,8 +367,11 @@ class ChannelProjectServiceTest extends TestCase
}
#[Test]
public function store_rejects_old_builder_channel_id(): void
public function store_accepts_old_builder_channel_id(): void
{
Process::fake([
'*' => Process::result(output: $this->fakeBuildResult()),
]);
$admin = Admin::query()->create(['username' => 'admin', 'password' => 'admin123']);
$this->actingAs($admin, 'admin')
@@ -377,9 +380,40 @@ class ChannelProjectServiceTest extends TestCase
'builder_type' => Channel::BUILDER_OLD,
'user_id' => 0,
])
->assertOk()
->assertJsonPath('code', 0)
->assertJsonPath('data.builder_type', Channel::BUILDER_OLD)
->assertJsonPath('data.seeds.deployment_seed', '11111111111111111111111111111111')
->assertJsonPath('data.domains.deployment.0', 'www.dep.example')
->assertJsonPath('data.support_path', '/web/'.self::CHANNEL_ID.'/support.html');
$this->assertDatabaseHas('channels', [
'channel_id' => self::CHANNEL_ID,
'builder_type' => Channel::BUILDER_OLD,
]);
Process::assertRan(function ($process) {
$joined = is_array($process->command) ? implode(' ', $process->command) : (string) $process->command;
return str_contains($joined, 'new_project.py')
&& str_contains($joined, self::CHANNEL_ID);
});
}
#[Test]
public function store_rejects_new_format_id_for_old_builder(): void
{
$admin = Admin::query()->create(['username' => 'admin', 'password' => 'admin123']);
$this->actingAs($admin, 'admin')
->post(route('admin.channels.store'), [
'channel_id' => self::NEW_CHANNEL_ID,
'builder_type' => Channel::BUILDER_OLD,
'user_id' => 0,
])
->assertSessionHasErrors('channel_id');
$this->assertDatabaseMissing('channels', ['channel_id' => self::CHANNEL_ID]);
$this->assertDatabaseMissing('channels', ['channel_id' => self::NEW_CHANNEL_ID]);
}
#[Test]