<commit_before><?php

namespace Admingenerator\GeneratorBundle\Tests\Twig\Extension;

use Admingenerator\GeneratorBundle\Tests\TestCase;

use Admingenerator\GeneratorBundle\Twig\Extension\EchoExtension;

use Symfony\Component\Templating\TemplateNameParser;

use Symfony\Component\Config\FileLocator;

use Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator;

use Symfony\Bundle\TwigBundle\Loader\FilesystemLoader;

/**
 * This class test the Admingenerator\GeneratorBundle\Twig\Extension\EchoExtension
 *
 * @author <NAME>
 */
class EchoExtensionTest extends TestCase
{
    protected static $params;

    public function setUp()
    {
        $object =  new Object();

        self::$params = array(
            'name' => 'cedric',
            'obj'  => $object,
            'arr'  => array('obj' => 'val'),
            'arr_obj' => array('obj' => $object),
            'options_form_collection_type_class' => "array( 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'type' => '\\\Admingenerator\\\PropelDemoBundle\\\Form\\\Type\\\ActorType',)",
            'options_form_collection_type_name' => "array( 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'type' => 'my_formType_name',)",
            'options_form_model' => "array( 'query' => '\\\Admingenerator\\\PropelDemoBundle\\\Model\\\ActorQuery::create()->orderById()',)",
            'options_form_choice_method' => "array( 'choices' => '\\\Admingenerator\\\PropelDemoBundle\\\Model\\\ActorQuery::getMyCustoms()',)",
            'options_form_choice_array' => "array( 'choices' => array('a' => 'b'),)",

        );
    }

    public function testI18n()
    {
        $tpls = array(
            'string' => '{{ "cedric"|i18n("foo") }}',
            'array' => '{{ arr|i18n("foo") }}',
        );

        $returns = array(
            'string' => array("cedric", 'i18n does not modify the string'),
            'array' => array("array(  'obj' => 'val', 'translation_domain' => 'foo')", 'i18n succesfully adds translation_domain to the array'),
        );

       $this->runTwigTests($tpls, $returns);
    }

    public function testConvertAsForm()
    {

        $tpls = array(
            'options_form_collection_type_class' => '{{ options_form_collection_type_class|convert_as_form("collection") }}',
            'options_form_collection_type_name' => '{{ options_form_collection_type_name|convert_as_form("collection") }}',
            'options_form_model' => '{{ options_form_model|convert_as_form("model") }}',
            'options_form_choice_method' => '{{ options_form_choice_method|convert_as_form("choice") }}',
            'options_form_choice_array' => '{{ options_form_choice_array|convert_as_form("choice") }}',
        );

        $returns = array(
            'options_form_collection_type_class' => array("array( 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'type' =>  new \Admingenerator\PropelDemoBundle\Form\Type\ActorType(),)", 'convert as form can convert the type option for the collection type'),
            'options_form_collection_type_name' => array("array( 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'type' => 'my_formType_name',)", 'convert as form can convert the type option for the collection type'),
            'options_form_model' => array("array( 'query' => \Admingenerator\PropelDemoBundle\Model\ActorQuery::create()->orderById(),)", 'convert as form can convert the query option for the model type'),
            'options_form_choice_method' => array("array( 'choices' => \Admingenerator\PropelDemoBundle\Model\ActorQuery::getMyCustoms(),)", 'convert as form can convert the choices option for the choice type'),
            'options_form_choice_array' => array("array( 'choices' => array('a' => 'b'),)", 'convert as form can convert the choices option for the choice type'),
        );

       $this->runTwigTests($tpls, $returns);
    }
<commit_msg>how i hate typos in tests :(<commit_after><?php

namespace Admingenerator\GeneratorBundle\Tests\Twig\Extension;

use Admingenerator\GeneratorBundle\Tests\TestCase;

use Admingenerator\GeneratorBundle\Twig\Extension\EchoExtension;

use Symfony\Component\Templating\TemplateNameParser;

use Symfony\Component\Config\FileLocator;

use Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator;

use Symfony\Bundle\TwigBundle\Loader\FilesystemLoader;

/**
 * This class test the Admingenerator\GeneratorBundle\Twig\Extension\EchoExtension
 *
 * @author <NAME>
 */
class EchoExtensionTest extends TestCase
{
    protected static $params;

    public function setUp()
    {
        $object =  new Object();

        self::$params = array(
            'name' => 'cedric',
            'obj'  => $object,
            'arr'  => array('obj' => 'val'),
            'arr_obj' => array('obj' => $object),
            'options_form_collection_type_class' => "array( 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'type' => '\\\Admingenerator\\\PropelDemoBundle\\\Form\\\Type\\\ActorType',)",
            'options_form_collection_type_name' => "array( 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'type' => 'my_formType_name',)",
            'options_form_model' => "array( 'query' => '\\\Admingenerator\\\PropelDemoBundle\\\Model\\\ActorQuery::create()->orderById()',)",
            'options_form_choice_method' => "array( 'choices' => '\\\Admingenerator\\\PropelDemoBundle\\\Model\\\ActorQuery::getMyCustoms()',)",
            'options_form_choice_array' => "array( 'choices' => array('a' => 'b'),)",

        );
    }

    public function testI18n()
    {
        $tpls = array(
            'string' => '{{ "cedric"|i18n("foo") }}',
            'array' => '{{ arr|i18n("foo") }}',
        );

        $returns = array(
            'string' => array("cedric", 'i18n does not modify the string'),
            'array' => array(array('obj' => 'val', 'translation_domain' => 'foo'), 'i18n succesfully adds translation_domain to the array'),
        );

       $this->runTwigTests($tpls, $returns);
    }

    public function testConvertAsForm()
    {

        $tpls = array(
            'options_form_collection_type_class' => '{{ options_form_collection_type_class|convert_as_form("collection") }}',
            'options_form_collection_type_name' => '{{ options_form_collection_type_name|convert_as_form("collection") }}',
            'options_form_model' => '{{ options_form_model|convert_as_form("model") }}',
            'options_form_choice_method' => '{{ options_form_choice_method|convert_as_form("choice") }}',
            'options_form_choice_array' => '{{ options_form_choice_array|convert_as_form("choice") }}',
        );

        $returns = array(
            'options_form_collection_type_class' => array("array( 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'type' =>  new \Admingenerator\PropelDemoBundle\Form\Type\ActorType(),)", 'convert as form can convert the type option for the collection type'),
            'options_form_collection_type_name' => array("array( 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'type' => 'my_formType_name',)", 'convert as form can convert the type option for the collection type'),
            'options_form_model' => array("array( 'query' => \Admingenerator\PropelDemoBundle\Model\ActorQuery::create()->orderById(),)", 'convert as form can convert the query option for the model type'),
            'options_form_choice_method' => array("array( 'choices' => \Admingenerator\PropelDemoBundle\Model\ActorQuery::getMyCustoms(),)", 'convert as form can convert the choices option for the choice type'),
            'options_form_choice_array' => array("array( 'choices' => array('a' => 'b'),)", 'convert as form can convert the choices option for the choice type'),
        );

       $this->runTwigTests($tpls, $returns);
    }

{'fraction_non_alphanumeric': 0.16113145599191817, 'fraction_numerical': 0.002525571410531633, 'mean_word_length': 3.6560846560846563, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 115, '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': '1548831', 'n_tokens_mistral': 2432, 'n_tokens_neox': 2374, 'n_words': 459}