<commit_before><?php

declare(strict_types=1);

namespace App\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class AppControllerTest extends WebTestCase
{
    public function testIndex(): void
    {
        $client = static::createClient();

        $client->request('GET', '/');

        $this->assertResponseIsSuccessful();
    }

    public function testIndexSubmittedWithBlankWebsite(): void
    {
        $client = static::createClient();

        $client->request('GET', '/');
        $client->submitForm('form[submit]', ['form[website]' => '']);

        $this->assertResponseRedirects('/duckduckgo.com', 303);
    }

    /**
     * @dataProvider validIndexWebsites
     */
    public function testIndexSubmittedWithValidWebsite(string $website, string $expectedWebsite): void
    {
        $client = static::createClient();

        $client->request('GET', '/');
        $client->submitForm('form[submit]', [
            'form[website]' => $website,
        ]);

        $this->assertResponseRedirects("/${expectedWebsite}", 303);
    }

    /**
     * @dataProvider invalidWebsites
     */
    public function testIndexSubmittedWithInvalidWebsite(string $website): void
    {
        $client = static::createClient();

        $client->request('GET', '/');
        $client->submitForm('form[submit]', [
            'form[website]' => $website,
        ]);

        $this->assertResponseRedirects("/${website}", 303);
    }

    /**
     * @dataProvider validWebsites
     */
    public function testCheckWithValidWebsite(string $website): void
    {
        $client = static::createClient();

        $client->request('GET', "/${website}");
<commit_msg>fix: disable rebooting the kernel for CSRF protected forms<commit_after><?php

declare(strict_types=1);

namespace App\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class AppControllerTest extends WebTestCase
{
    public function testIndex(): void
    {
        $client = static::createClient();

        $client->request('GET', '/');

        $this->assertResponseIsSuccessful();
    }

    public function testIndexSubmittedWithBlankWebsite(): void
    {
        $client = static::createClient();
        $client->disableReboot();

        $client->request('GET', '/');
        $client->submitForm('form[submit]');

        $this->assertResponseRedirects('/duckduckgo.com', 303);
    }

    /**
     * @dataProvider validIndexWebsites
     */
    public function testIndexSubmittedWithValidWebsite(string $website, string $expectedWebsite): void
    {
        $client = static::createClient();
        $client->disableReboot();

        $client->request('GET', '/');
        $client->submitForm('form[submit]', [
            'form[website]' => $website,
        ]);

        $this->assertResponseRedirects("/${expectedWebsite}", 303);
    }

    /**
     * @dataProvider invalidWebsites
     */
    public function testIndexSubmittedWithInvalidWebsite(string $website): void
    {
        $client = static::createClient();
        $client->disableReboot();

        $client->request('GET', '/');
        $client->submitForm('form[submit]', [
            'form[website]' => $website,
        ]);

        $this->assertResponseRedirects("/${website}", 303);
    }

    /**
     * @dataProvider validWebsites
     */
    public function testCheckWithValidWebsite(string $website): void
    {
        $client = static::createClient();

        $client->request('GET', "/${website}");

{'fraction_non_alphanumeric': 0.15780445969125215, 'fraction_numerical': 0.005717552887364208, 'mean_word_length': 2.887777777777778, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2257552', 'n_tokens_mistral': 1025, 'n_tokens_neox': 937, 'n_words': 154}