File tree Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,11 @@ private function getOutput()
108108 */
109109 public function theCommandHasFinishedSuccessfully ()
110110 {
111- Assert::assertEquals (0 , $ this ->tester ->getStatusCode ());
111+ if ($ this ->tester ->getStatusCode () !== 0 ) {
112+ throw new RuntimeException (
113+ "Expected the command to succeed. Command output: \n" . $ this ->getOutput ()
114+ );
115+ }
112116 }
113117
114118 /**
Original file line number Diff line number Diff line change @@ -48,6 +48,19 @@ Feature: It is possible to interactively fill in a form from the CLI
4848 )
4949 """
5050
51+ Scenario : Provide an integer
52+ When I run the command "form:age" and I provide as input
53+ | Input |
54+ | 10 |
55+ Then the command has finished successfully
56+ And the output should be
57+ """
58+ Your age: Array
59+ (
60+ [age] => 10
61+ )
62+ """
63+
5164 Scenario : Select a value
5265 When I run the command "form:color" and I provide as input
5366 | Input |
Original file line number Diff line number Diff line change 1+ <?php
2+ declare (strict_types=1 );
3+
4+ namespace Matthias \SymfonyConsoleForm \Tests \Form ;
5+
6+ use Symfony \Component \Form \AbstractType ;
7+ use Symfony \Component \Form \Extension \Core \Type \IntegerType ;
8+ use Symfony \Component \Form \FormBuilderInterface ;
9+
10+ final class AgeType extends AbstractType
11+ {
12+ public function buildForm (FormBuilderInterface $ builder , array $ options )
13+ {
14+ $ builder ->add ('age ' , IntegerType::class, ['label ' => 'Your age ' ]);
15+ }
16+ }
Original file line number Diff line number Diff line change @@ -66,6 +66,14 @@ services:
6666 tags :
6767 - { name: console.command }
6868
69+ age_command :
70+ class : Matthias\SymfonyConsoleForm\Tests\Command\PrintFormDataCommand
71+ arguments :
72+ - Matthias\SymfonyConsoleForm\Tests\Form\AgeType
73+ - age
74+ tags :
75+ - { name: console.command }
76+
6977 empty_label_command :
7078 class : Matthias\SymfonyConsoleForm\Tests\Command\PrintFormDataCommand
7179 arguments :
You can’t perform that action at this time.
0 commit comments