<commit_before><?php
namespace ADmad\I18n\Test\Routing\Route;

use ADmad\I18n\Routing\Route\I18nRoute;
use Cake\Core\Configure;
use Cake\Routing\Router;
use Cake\TestSuite\TestCase;

/**
 * Tests for I18nRoute.
 */
class I18nRouteTest extends TestCase
{
    /**
     * setUp method.
     *
     * @return void
     */
    public function setUp()
    {
        Configure::write('I18n.languages', ['en', 'fr', 'de']);

        Router::reload();
    }

    /**
     * Test constructor.
     *
     * @return void
     */
    public function testConstructor()
    {
        $route = new I18nRoute('/:controller/:action');
        $this->assertEquals('/:lang/:controller/:action', $route->template);
        $this->assertEquals([], $route->defaults);
        $this->assertEquals(
            [
                'lang' => 'en|fr|de',
                'inflect' => 'dasherize',
                'persist' => ['lang'],
            ],
            $route->options
        );

        $route = new I18nRoute('/');
        $this->assertEquals('/:lang', $route->template);

        $route = new I18nRoute('/:controller/:action', [], ['lang' => 'fr|es']);
        $this->assertEquals('fr|es', $route->options['lang']);

        $route = new I18nRoute('/prefix/:lang/:controller');
        $this->assertEquals('/prefix/:lang/:controller', $route->template);
    }<commit_msg>Fix test<commit_after><?php
namespace ADmad\I18n\Test\Routing\Route;

use ADmad\I18n\Routing\Route\I18nRoute;
use Cake\Core\Configure;
use Cake\Routing\Router;
use Cake\TestSuite\TestCase;

/**
 * Tests for I18nRoute.
 */
class I18nRouteTest extends TestCase
{
    /**
     * setUp method.
     *
     * @return void
     */
    public function setUp()
    {
        Configure::write('I18n.languages', ['en', 'fr', 'de']);

        Router::reload();
    }

    /**
     * Test constructor.
     *
     * @return void
     */
    public function testConstructor()
    {
        $route = new I18nRoute('/:controller/:action');
        $this->assertEquals('/:lang/:controller/:action', $route->template);
        $this->assertEquals([], $route->defaults);
        $this->assertEquals(
            [
                'lang' => 'en|fr|de',
                'inflect' => 'dasherize',
                'persist' => ['lang'],
                '_ext' => []
            ],
            $route->options
        );

        $route = new I18nRoute('/');
        $this->assertEquals('/:lang', $route->template);

        $route = new I18nRoute('/:controller/:action', [], ['lang' => 'fr|es']);
        $this->assertEquals('fr|es', $route->options['lang']);

        $route = new I18nRoute('/prefix/:lang/:controller');
        $this->assertEquals('/prefix/:lang/:controller', $route->template);
    }
{'fraction_non_alphanumeric': 0.1877282688093499, 'fraction_numerical': 0.014609203798392988, 'mean_word_length': 2.1960326721120187, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 36, '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': '2758964', 'n_tokens_mistral': 862, 'n_tokens_neox': 841, 'n_words': 140}