55 lines
No EOL
1.5 KiB
PHP
55 lines
No EOL
1.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Article;
|
|
use App\Models\Feed;
|
|
use App\Models\PlatformAccount;
|
|
use App\Models\PlatformChannel;
|
|
use App\Models\Setting;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class ApiAccessTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_health_endpoint_is_accessible(): void
|
|
{
|
|
$response = $this->get('/health');
|
|
$response->assertSuccessful();
|
|
}
|
|
|
|
public function test_api_routes_are_publicly_accessible(): void
|
|
{
|
|
// Test that main API routes are accessible without authentication
|
|
$routes = [
|
|
'/api/v1/articles',
|
|
'/api/v1/dashboard/stats',
|
|
'/api/v1/platform-accounts',
|
|
'/api/v1/platform-channels',
|
|
'/api/v1/feeds',
|
|
'/api/v1/routing',
|
|
'/api/v1/settings',
|
|
'/api/v1/logs'
|
|
];
|
|
|
|
foreach ($routes as $route) {
|
|
$response = $this->get($route);
|
|
$this->assertTrue(
|
|
$response->isSuccessful(),
|
|
"API route {$route} should be publicly accessible"
|
|
);
|
|
}
|
|
}
|
|
|
|
public function test_fallback_route_returns_api_message(): void
|
|
{
|
|
$response = $this->get('/nonexistent-route');
|
|
$response->assertStatus(404);
|
|
$response->assertJson([
|
|
'message' => 'This is the FFR API backend. Use /api/v1/* endpoints or check the React frontend.',
|
|
'api_base' => '/api/v1'
|
|
]);
|
|
}
|
|
} |