<?php

namespace App\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class OnlineSpecialistsControllerTest extends WebTestCase
{
    private const BROWSER_HEADERS = ['HTTP_USER_AGENT' => 'PHPUnit/OnlineConsultationTest'];

    public function testOnlineSpecialistsRequiresAuthentication(): void
    {
        $client = static::createClient();
        $client->request('GET', '/online-specialists', [], [], self::BROWSER_HEADERS);

        $this->assertTrue(
            $client->getResponse()->isRedirect() || $client->getResponse()->getStatusCode() === 401,
            'Online specialists page must require authentication'
        );
    }

    public function testOfflineSpecialistsListIsPublic(): void
    {
        $client = static::createClient();
        $client->request('GET', '/specialists', [], [], self::BROWSER_HEADERS);

        $this->assertResponseIsSuccessful();
    }

    public function testIntervalApiRequiresParameters(): void
    {
        $client = static::createClient();
        $client->request('GET', '/api/interval', [], [], self::BROWSER_HEADERS);

        $this->assertGreaterThanOrEqual(400, $client->getResponse()->getStatusCode());
    }
}
