refactor(vikon): fetch parts from VIKON API instead of hardcoded config

This commit is contained in:
F4ilji
2026-07-05 11:32:54 +05:00
parent 9a9521c570
commit 8cf195efb0
7 changed files with 36 additions and 41 deletions
@@ -51,21 +51,6 @@ class UpdatePartActionTest extends TestCase
$action->run(999, 'common', 'token');
}
public function test_rejects_invalid_part(): void
{
$http = Mockery::mock(HttpTask::class);
$fs = Mockery::mock(FilesystemTask::class);
$poll = Mockery::mock(PollPartStatusTask::class);
$action = new UpdatePartAction($http, $fs, $poll, $this->tempDir, $this->tempDir, [
1 => ['path' => 'sveden', 'allowed_folders' => ['common']],
]);
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage("Invalid part 'nonexistent' for module 1");
$action->run(1, 'nonexistent', 'token');
}
public function test_requests_generation_and_polls_status(): void
{
$http = Mockery::mock(HttpTask::class);
@@ -117,8 +102,6 @@ class UpdatePartActionTest extends TestCase
->once()
->andReturn(true);
config(['vikon.parts' => [1 => ['common']]]);
$action = new UpdatePartAction($http, $fs, $poll, $this->tempDir, $this->tempDir, [
1 => ['path' => 'sveden', 'allowed_folders' => ['common']],
]);
@@ -141,8 +124,6 @@ class UpdatePartActionTest extends TestCase
'message' => 'Generation not available',
]));
config(['vikon.parts' => [1 => ['common']]]);
$action = new UpdatePartAction($http, $fs, $poll, $this->tempDir, $this->tempDir, [
1 => ['path' => 'sveden', 'allowed_folders' => ['common']],
]);
@@ -169,8 +150,6 @@ class UpdatePartActionTest extends TestCase
->once()
->andReturn(['status' => 'failed', 'error' => 'Server error']);
config(['vikon.parts' => [1 => ['common']]]);
$action = new UpdatePartAction($http, $fs, $poll, $this->tempDir, $this->tempDir, [
1 => ['path' => 'sveden', 'allowed_folders' => ['common']],
]);