<?php

declare(strict_types=1);

namespace App\Tests\Functional\Shared;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

/**
 * @internal
 */
final class ModulesEndpointTest extends WebTestCase
{
    public function testModulesEndpointIsPublicAndReturnsModulesKey(): void
    {
        $client = self::createClient();
        $client->request('GET', '/api/modules');

        self::assertResponseIsSuccessful();
        $data = json_decode($client->getResponse()->getContent(), true);
        self::assertArrayHasKey('modules', $data);
        self::assertIsArray($data['modules']);
    }

    public function testCoreModuleIsActive(): void
    {
        $client = self::createClient();
        $client->request('GET', '/api/modules');

        self::assertResponseIsSuccessful();
        $data = json_decode($client->getResponse()->getContent(), true);
        self::assertContains('core', $data['modules']);
    }
}
