Skip to content

Commit 97ca788

Browse files
simonhampclaude
andcommitted
Filter satis:build to only include paid plugins
The buildAll command was including all approved plugins (both free and paid) in satis builds. This filters getApprovedPlugins() to only return paid plugins, since free plugins don't need private Composer repository distribution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d65ef9c commit 97ca788

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

app/Services/SatisService.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Services;
44

5+
use App\Enums\PluginType;
56
use App\Models\Plugin;
67
use Illuminate\Support\Facades\Http;
78
use Illuminate\Support\Facades\Log;
@@ -107,6 +108,7 @@ protected function getApprovedPlugins(): array
107108
{
108109
return Plugin::query()
109110
->approved()
111+
->where('type', PluginType::Paid)
110112
->get()
111113
->map(fn (Plugin $plugin) => [
112114
'name' => $plugin->name,

tests/Feature/SatisSync/SatisSyncTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use App\Services\SatisService;
1010
use Illuminate\Foundation\Testing\RefreshDatabase;
1111
use Illuminate\Support\Facades\Bus;
12+
use Illuminate\Support\Facades\Http;
1213
use Livewire\Livewire;
1314
use Tests\TestCase;
1415

@@ -124,4 +125,26 @@ public function test_is_satis_synced_returns_true_when_synced(): void
124125

125126
$this->assertTrue($plugin->isSatisSynced());
126127
}
128+
129+
public function test_build_all_only_includes_paid_plugins(): void
130+
{
131+
Http::fake(['*' => Http::response(['job_id' => 'test-123', 'message' => 'Build started'], 200)]);
132+
133+
config(['services.satis.url' => 'https://satis.test', 'services.satis.api_key' => 'test-key']);
134+
135+
$paidPlugin = Plugin::factory()->paid()->approved()->create();
136+
Plugin::factory()->free()->approved()->create();
137+
138+
$service = new SatisService;
139+
$result = $service->buildAll();
140+
141+
$this->assertTrue($result['success']);
142+
$this->assertEquals(1, $result['plugins_count']);
143+
144+
Http::assertSent(function ($request) use ($paidPlugin) {
145+
$plugins = $request->data()['plugins'] ?? [];
146+
147+
return count($plugins) === 1 && $plugins[0]['name'] === $paidPlugin->name;
148+
});
149+
}
127150
}

0 commit comments

Comments
 (0)