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()
108
108
*/
109
109
public function theCommandHasFinishedSuccessfully ()
110
110
{
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
+ }
112
116
}
113
117
114
118
/**
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
48
48
)
49
49
"""
50
50
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
+
51
64
Scenario : Select a value
52
65
When I run the command "form:color" and I provide as input
53
66
| 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:
66
66
tags :
67
67
- { name: console.command }
68
68
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
+
69
77
empty_label_command :
70
78
class : Matthias\SymfonyConsoleForm\Tests\Command\PrintFormDataCommand
71
79
arguments :
You can’t perform that action at this time.
0 commit comments