<?php

namespace App\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class RobotsControllerTest extends WebTestCase
{
    public function testRobotsReturnsPlainText(): void
    {
        $client = static::createClient();
        $client->request('GET', '/robots.txt');

        self::assertResponseIsSuccessful();
        self::assertStringContainsString('text/plain', $client->getResponse()->headers->get('Content-Type'));
    }

    public function testRobotsContainsSitemap(): void
    {
        $client = static::createClient();
        $client->request('GET', '/robots.txt');

        self::assertStringContainsString('Sitemap:', $client->getResponse()->getContent());
    }

    public function testRobotsContainsDisallowRules(): void
    {
        $client = static::createClient();
        $client->request('GET', '/robots.txt');

        $content = $client->getResponse()->getContent();
        self::assertStringContainsString('Disallow: /external-redirect', $content);
        self::assertStringContainsString('Disallow: /my-csp-report', $content);
    }
}
