- Use assertStringContainsString for Content-Type (Symfony adds charset) - Create fake logo.jpg in CI for EmailTracking test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?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);
|
|
}
|
|
}
|