input example

 else {
                $extraOutput  = '[' . $extraOutputDefault . ', ' . implode(', ', $opts) . ']';
                $validation[] = 'in_list[' . implode(', ', $options) . ']';
            }

            $default = $options[0];
        }

        static::fwrite(STDOUT, $field . (trim($field) ? ' ' : '') . $extraOutput . ': ');

        // Read the input from keyboard.         $input = trim(static::input()) ?: $default;

        if ($validation) {
            while (static::validate(trim($field)$input$validation)) {
                $input = static::prompt($field$options$validation);
            }
        }

        return $input;
    }

    /** * prompt(), but based on the option's key * * @param array|string $text Output "field" text or an one or two value array where the first value is the text before listing the options * and the second value the text before asking to select one option. Provide empty string to omit * @param array $options A list of options (array(key => description)), the first option will be the default value * @param array|string|null $validation Validation rules * * @return string The selected key of $options * * @codeCoverageIgnore */
->name($value = 'My name');

        $this->assertSame($value$action->toArray()['name']);
    }

    /** * @dataProvider availableInputs */
    public function testInput(array $expected, InputInterface $input)
    {
        $action = (new ActionCard())
            ->input($input);

        $this->assertCount(1, $action->toArray()['inputs']);
        $this->assertSame($expected$action->toArray()['inputs']);
    }

    public static function availableInputs(): \Generator
    {
        yield [[['@type' => 'DateInput']]new DateInput()];
        yield [[['@type' => 'TextInput']]new TextInput()];
        yield [[['@type' => 'MultichoiceInput']]new MultiChoiceInput()];
    }

    
Home | Imprint | This part of the site doesn't use cookies.