added a help system, replaced the words "tenant" and "Pwa" with better alternatives. corrected and implemented cron jobs. prepared going live on a coolify-powered system.

This commit is contained in:
Codex Agent
2025-11-10 16:23:09 +01:00
parent ba9e64dfcb
commit 447a90a742
123 changed files with 6398 additions and 153 deletions

View File

@@ -0,0 +1,59 @@
<?php
namespace Tests\Feature\Api;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Storage;
use Laravel\Sanctum\Sanctum;
use Tests\TestCase;
class HelpControllerTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
Storage::fake('local');
$this->artisan('help:sync');
}
public function test_guest_help_listing_is_public(): void
{
$response = $this->getJson('/api/v1/help?audience=guest&locale=en');
$response->assertOk()
->assertJsonStructure(['data' => [['slug', 'title', 'summary']]])
->assertJsonFragment(['slug' => 'getting-started']);
}
public function test_guest_help_detail_returns_article(): void
{
$response = $this->getJson('/api/v1/help/getting-started?audience=guest&locale=en');
$response->assertOk()
->assertJsonPath('data.slug', 'getting-started');
$this->assertStringContainsString('When to read this', $response->json('data.body_html'));
}
public function test_admin_help_requires_authentication(): void
{
$this->getJson('/api/v1/help?audience=admin&locale=en')->assertStatus(401);
}
public function test_admin_help_allows_authenticated_users(): void
{
$user = User::factory()->create([
'role' => 'tenant_admin',
]);
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/help?audience=admin&locale=en');
$response->assertOk()
->assertJsonFragment(['slug' => 'tenant-dashboard-overview']);
}
}