<commit_before><?php

namespace Sandbox\InitCmsBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

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

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

        $this->assertEquals(
            200,
            $client->getResponse()->getStatusCode()
        );
        $this->assertTrue($crawler->filter('h3:contains("Demo Sailing Club")')->count() == 1, 'Its the demo sailing club');
        $this->assertTrue($crawler->filter('.header ul li.active a:contains("English")')->count() == 1, 'English');

        $this->assertTrue($crawler->filter('.hero-unit p:contains("The locale of this page is en_US")')->count() == 1, 'Language is English');
        $this->assertRegExp('#<h3>Demo Sailing Club</h3>#', $client->getResponse()->getContent(), 'its the demo sailing club');

    }

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

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

        $this->assertTrue($crawler->filter('a:contains("Deutsch")')->count() == 1, 'there is a link for deutsch');

        $link = $crawler->selectLink('Deutsch')->link();
        $crawler = $client->click($link);
        $this->assertTrue($client->getResponse()->isRedirect('/'), 'language switch does a redirect');
        $crawler = $client->followRedirect();
        $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'no further redirect');
        $this->assertTrue($crawler->filter('.hero-unit p:contains("The locale of this page is de_CH")')->count() == 1, 'Language is switched');
        $this->assertTrue($crawler->filter('.header ul li.active a:contains("Deutsch")')->count() == 1, 'active is german');
        $this->assertTrue($crawler->filter('.header ul li.active a:contains("English")')->count() == 0, 'english is not active');
    }

}<commit_msg>changed some tests for frontend language control<commit_after><?php

namespace Sandbox\InitCmsBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class FrontendControllerTest extends WebTestCase
{

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

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

        $this->assertTrue($crawler->filter('a:contains("Deutsch")')->count() == 1, 'there is a link for deutsch');

        $link = $crawler->selectLink('Deutsch')->link();
        $crawler = $client->click($link);
        $this->assertTrue($client->getResponse()->isRedirect('/'), 'language switch does a redirect');
        $crawler = $client->followRedirect();
        $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'no further redirect');
        $this->assertTrue($crawler->filter('.hero-unit p:contains("The locale of this page is de_CH")')->count() == 1, 'Language is switched');
        $this->assertTrue($crawler->filter('.header ul li.active a:contains("Deutsch")')->count() == 1, 'active is german');
        $this->assertTrue($crawler->filter('.header ul li.active a:contains("English")')->count() == 0, 'english is not active');
    }

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

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

        $this->assertTrue($crawler->filter('a:contains("English")')->count() == 1, 'there is a link for english');

        $link = $crawler->selectLink('English')->link();
        $crawler = $client->click($link);
        $this->assertTrue($client->getResponse()->isRedirect('/'), 'language switch does a redirect');
        $crawler = $client->followRedirect();
        $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'no further redirect');
        $this->assertTrue($crawler->filter('.hero-unit p:contains("The locale of this page is en_US")')->count() == 1, 'Language is switched');
        $this->assertTrue($crawler->filter('.header ul li.active a:contains("English")')->count() == 1, 'active is English');
        $this->assertTrue($crawler->filter('.header ul li.active a:contains("Deutsch")')->count() == 0, 'german is not active');
    }

}
{'fraction_non_alphanumeric': 0.1932275633435946, 'fraction_numerical': 0.007103954534690978, 'mean_word_length': 3.923076923076923, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 90, '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': '2405533', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1203, 'n_words': 253}