<commit_before><?php
namespace Browser\Tests;

use Browser\Language;
use PHPUnit_Framework_TestCase;

class LanguageTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var Language
     */
    private $language;

    public function setUp()
    {
        $httpAcceptLanguage = "fr-CA,fr;q=0.8,en-CA;q=0.6,en;q=0.4,en-US;q=0.2";
        $this->language = new Language($httpAcceptLanguage);
    }

    public function testGetLanguage()
    {
        $this->assertEquals('fr', $this->language->getLanguage());
    }

    public function testGetLanguages()
    {
        $this->assertGreaterThan(0, sizeof($this->language->getLanguages()));
    }

    public function testGetLanguageLocal()
    {
        $this->assertEquals('fr-CA', $this->language->getLanguageLocale());
    }
}<commit_msg>up to 100% test coverage of \Browser\Language<commit_after><?php
namespace Browser\Tests;

use Browser\AcceptLanguage;
use Browser\Language;
use PHPUnit_Framework_TestCase;

class LanguageTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var Language
     */
    private $language;

    public function setUp()
    {
        $httpAcceptLanguage = "fr-CA,fr;q=0.8,en-CA;q=0.6,en;q=0.4,en-US;q=0.2";
        $this->language = new Language($httpAcceptLanguage);
    }

    public function testGetLanguage()
    {
        $this->assertEquals('fr', $this->language->getLanguage());
    }

    public function testGetLanguages()
    {
        $this->assertGreaterThan(0, sizeof($this->language->getLanguages()));
    }

    public function testGetLanguageLocal()
    {
        $this->assertEquals('fr-CA', $this->language->getLanguageLocale());
    }

    public function testConstructor()
    {
        $acceptLanguage = new AcceptLanguage('my_accept_language_string');
        $language = new Language($acceptLanguage);

        $this->assertInstanceOf('\Browser\AcceptLanguage', $acceptLanguage);
        $this->assertInstanceOf('\Browser\Language', $language);
    }

    /**
     * @expectedException \Browser\InvalidArgumentException
     */
    public function testConstructorException()
    {
        $language = new Language(1);
    }

    public function testGetLanguageLocale()
    {
        $language = new Language('ru,en-us;q=0.5,en;q=0.3');
        $this->assertEquals('ru', $language->getLanguageLocale());
    }


}
{'fraction_non_alphanumeric': 0.14347079037800686, 'fraction_numerical': 0.011168384879725086, 'mean_word_length': 3.2115732368896928, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '508118', 'n_tokens_mistral': 703, 'n_tokens_neox': 683, 'n_words': 113}