<commit_before><?php

namespace Kmelia\FreshBundle\Tests;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class BaseFunctionalTest extends WebTestCase
{
    public function testHomepage()
    {
        $client = static::createClient();
        
        $crawler  = $client->request('GET', '/');
        $response = $client->getResponse();
        
        // content
        $this->assertGreaterThan(0, $crawler->filter('html:contains("fresh")')->count(), 'Word "fresh"');
        
        // headers
        $this->assertTrue($response->isOk(), 'Http code 200');
        $this->assertTrue($response->headers->contains('Content-Type', 'text/html; charset=UTF-8'), 'Html utf-8 page');
        $this->assertTrue($response->headers->hasCacheControlDirective('max-age'), 'Cache control max-age');
        $this->assertTrue($response->headers->hasCacheControlDirective('s-maxage'), 'Cache control s-maxage');
        $this->assertTrue($response->headers->hasCacheControlDirective('must-revalidate'), 'Cache control must-revalidate');
        $this->assertTrue($response->headers->has('Expires'), 'Header expires');
    }
    
    public function testNoHttpCacheHomepage()
    {
        $client = static::createClient();
        
        $crawler  = $client->request('GET', '/no-http-cache');
        $response = $client->getResponse();
        
        // headers
        $this->assertTrue($response->isOk(), 'Http code 200');
        $this->assertFalse($response->isCacheable(), 'Response cacheable');
        $this->assertTrue($response->headers->contains('Cache-Control', 'no-cache'), 'Header cache control no-cache');
        $this->assertFalse($response->headers->has('Expires'), 'Header expires');
    }
}<commit_msg>remove unused variable<commit_after><?php

namespace Kmelia\FreshBundle\Tests;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class BaseFunctionalTest extends WebTestCase
{
    public function testHomepage()
    {
        $client = static::createClient();
        
        $crawler  = $client->request('GET', '/');
        $response = $client->getResponse();
        
        // content
        $this->assertGreaterThan(0, $crawler->filter('html:contains("fresh")')->count(), 'Word "fresh"');
        
        // headers
        $this->assertTrue($response->isOk(), 'Http code 200');
        $this->assertTrue($response->headers->contains('Content-Type', 'text/html; charset=UTF-8'), 'Html utf-8 page');
        $this->assertTrue($response->headers->hasCacheControlDirective('max-age'), 'Cache control max-age');
        $this->assertTrue($response->headers->hasCacheControlDirective('s-maxage'), 'Cache control s-maxage');
        $this->assertTrue($response->headers->hasCacheControlDirective('must-revalidate'), 'Cache control must-revalidate');
        $this->assertTrue($response->headers->has('Expires'), 'Header expires');
    }
    
    public function testNoHttpCacheHomepage()
    {
        $client = static::createClient();
        
        $client->request('GET', '/no-http-cache');
        $response = $client->getResponse();
        
        // headers
        $this->assertTrue($response->isOk(), 'Http code 200');
        $this->assertFalse($response->isCacheable(), 'Response cacheable');
        $this->assertTrue($response->headers->contains('Cache-Control', 'no-cache'), 'Header cache control no-cache');
        $this->assertFalse($response->headers->has('Expires'), 'Header expires');
    }
}
{'fraction_non_alphanumeric': 0.17696547722657383, 'fraction_numerical': 0.005221932114882507, 'mean_word_length': 3.38676844783715, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 71, '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': '973959', 'n_tokens_mistral': 957, 'n_tokens_neox': 949, 'n_words': 153}