<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',
      ]
    ];

    return [
      // case one
      [
        // Inline options
        [],
        // Expected options
        ['foo', 'DefaultForm', 'default_form' , $services, $inputs, true],
        // User input options
        "foo\nDefaultForm\ndefault_form\nyes\ntwig\n\nyes\nBar\nbar\ntextfield\n",
      ],
      // case two
      [
        // Inline options<commit_msg>Enable add select, radios, checkboxes fields in form, with option to add options values<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' => 'one, two',
      ]
    ];

    return [
      // case one
      [
        // Inline options
        [],
        // Expected options
        ['foo', 'DefaultForm', 'default_form' , $services, $inputs, true],
        // User input options
        "foo\nDefaultForm\ndefault_form\nyes\ntwig\n\nyes\nBar\nbar\ntextfield\n",
      ],
      // case two
      [
        // Inline options
{'fraction_non_alphanumeric': 0.15816164817749603, 'fraction_numerical': 0.0, 'mean_word_length': 2.530201342281879, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, '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': '4727030', 'n_tokens_mistral': 996, 'n_tokens_neox': 996, 'n_words': 183}