<commit_before><?php
/**
 * @file
 * Contains \Drupal\AppConsole\Test\Command\GeneratorModuleCommandTest.
 */

namespace Drupal\AppConsole\Test\Command;

use Symfony\Component\Console\Tester\CommandTester;

class GeneratorFormCommandTest extends GenerateCommandTest
{
    /**
     * @dataProvider getInteractiveData
     */
    public function testInteractive($options, $expected, $input)
    {
        list($module, $class_name, $form_id, $services, $inputs, $routing_update) = $expected;

        $generator = $this->getGenerator();
        $generator
          ->expects($this->once())
          ->method('generate')
          ->with($module, $class_name, $form_id, $services, $inputs, $routing_update);

        $command = $this->getCommand($generator, $input);
        $cmd = new CommandTester($command);
        $cmd->execute($options);
    }

    public function getInteractiveData()
    {
        $services = [
          'twig' => [
            'name' => 'twig',
            'machine_name' => 'twig',
            'class' => 'Twig_Environment',
            'short' => 'Twig_Environment',
          ]
        ];

        $inputs = [
          [
            'name' => 'bar',
            'type' => 'textfield',
            'label' => 'Bar',
            'options' => '',
            'description' => 'Baz',
          ]
        ];

        return [
            // case one
          [<commit_msg>Added to test field maxlength and size<commit_after><?php
/**
 * @file
 * Contains \Drupal\AppConsole\Test\Command\GeneratorModuleCommandTest.
 */

namespace Drupal\AppConsole\Test\Command;

use Symfony\Component\Console\Tester\CommandTester;

class GeneratorFormCommandTest extends GenerateCommandTest
{
    /**
     * @dataProvider getInteractiveData
     */
    public function testInteractive($options, $expected, $input)
    {
        list($module, $class_name, $form_id, $services, $inputs, $routing_update) = $expected;

        $generator = $this->getGenerator();
        $generator
          ->expects($this->once())
          ->method('generate')
          ->with($module, $class_name, $form_id, $services, $inputs, $routing_update);

        $command = $this->getCommand($generator, $input);
        $cmd = new CommandTester($command);
        $cmd->execute($options);
    }

    public function getInteractiveData()
    {
        $services = [
          'twig' => [
            'name' => 'twig',
            'machine_name' => 'twig',
            'class' => 'Twig_Environment',
            'short' => 'Twig_Environment',
          ]
        ];

        $inputs = [
          [
            'name' => 'bar',
            'type' => 'textfield',
            'label' => 'Bar',
            'options' => '',
            'description' => 'Baz',
            'maxlength' => 60,
            'size' => 15
          ]
        ];

        return [
            // case one
          [
{'fraction_non_alphanumeric': 0.15119916579770595, 'fraction_numerical': 0.0013903371567605145, 'mean_word_length': 1.963954685890834, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '4656731', 'n_tokens_mistral': 830, 'n_tokens_neox': 825, 'n_words': 150}