@@ -33,7 +33,7 @@ protected function successfulConsoleApp() : void
3333 $ container ->setService (
3434 'commands ' ,
3535 [
36- SelamiConsoleTest \Command \OrdinaryCommand ::class
36+ SelamiConsoleTest \Command \GreetingCommand ::class
3737 ]
3838 );
3939 $ this ->container = $ container ;
@@ -49,18 +49,19 @@ protected function failedConsoleApp() : void
4949 $ container ->setService (
5050 'config ' ,
5151 [
52- 'cache ' => '/tmp/uRt48sl '
52+ 'greeting ' => 'Dear '
5353 ]
5454 );
5555 $ container ->setService (
5656 'commands ' ,
5757 [
58- SelamiConsoleTest \Command \OrdinaryCommand ::class,
59- SelamiConsoleTest \Command \OrdinaryCommandWithArrayDependency ::class,
58+ SelamiConsoleTest \Command \GreetingCommand ::class,
59+ SelamiConsoleTest \Command \GreetingCommandWithArrayDependency ::class,
6060 ]
6161 );
6262 $ this ->container = $ container ;
6363 }
64+
6465 protected function failedForNonExistingServiceConsoleApp () : void
6566 {
6667 $ container = new ServiceManager ([
@@ -77,8 +78,8 @@ protected function failedForNonExistingServiceConsoleApp() : void
7778 $ container ->setService (
7879 'commands ' ,
7980 [
80- SelamiConsoleTest \Command \OrdinaryCommand ::class,
81- SelamiConsoleTest \Command \OrdinaryCommandWithServiceDependency ::class,
81+ SelamiConsoleTest \Command \GreetingCommand ::class,
82+ SelamiConsoleTest \Command \GreetingCommandWithServiceDependency ::class,
8283 ]
8384 );
8485 $ this ->container = $ container ;
@@ -94,14 +95,15 @@ protected function _after()
9495 public function shouldRunCommandSuccessfully () : void
9596 {
9697 $ this ->successfulConsoleApp ();
97- $ input = new ArrayInput (array ('command ' => 'command:ordinary ' , 'name ' => 'Kedibey ' ));
9898 $ cli = Console \ApplicationFactory::makeApplication ($ this ->container , 'TestApp ' , '1.0.1 ' );
9999 $ cli ->setAutoExit (false );
100100 $ this ->assertEquals ('TestApp ' , $ cli ->getName ());
101101 $ this ->assertEquals ('1.0.1 ' , $ cli ->getVersion ());
102+ $ input = new ArrayInput (['command ' => 'command:greeting ' , 'name ' => 'Kedibey ' ]);
102103 $ output = new BufferedOutput ();
103104 $ cli ->run ($ input , $ output );
104105 $ return = $ output ->fetch ();
106+ var_dump ($ return );
105107 $ this ->assertEquals ('Hello Dear Kedibey ' . PHP_EOL , $ return );
106108 }
107109
@@ -112,7 +114,7 @@ public function shouldRunCommandSuccessfully() : void
112114 public function shouldFailNonExistingArrayDependency () : void
113115 {
114116 $ this ->failedConsoleApp ();
115- $ input = new ArrayInput (array ('command ' =>'command:ordinary -with-array-dependency ' , 'name ' => 'world ' ));
117+ $ input = new ArrayInput (array ('command ' =>'command:greeting -with-array-dependency ' , 'name ' => 'world ' ));
116118 $ cli = Console \ApplicationFactory::makeApplication ($ this ->container , 'TestApp ' , '1.0.1 ' );
117119 $ cli ->setAutoExit (false );
118120 $ this ->assertEquals ('TestApp ' , $ cli ->getName ());
@@ -127,7 +129,7 @@ public function shouldFailNonExistingArrayDependency() : void
127129 public function shouldFailNonExistingServiceDependency () : void
128130 {
129131 $ this ->failedForNonExistingServiceConsoleApp ();
130- $ input = new ArrayInput (array ('command ' =>'command:ordinary -with-service-dependency ' , 'name ' => 'world ' ));
132+ $ input = new ArrayInput (array ('command ' =>'command:greeting -with-service-dependency ' , 'name ' => 'world ' ));
131133 $ cli = Console \ApplicationFactory::makeApplication ($ this ->container , 'TestApp ' , '1.0.1 ' );
132134 $ cli ->setAutoExit (false );
133135 $ this ->assertEquals ('TestApp ' , $ cli ->getName ());
@@ -142,7 +144,7 @@ public function shouldFailNonExistingServiceDependency() : void
142144 public function shouldFailNonExistingSCommandDependency () : void
143145 {
144146 $ this ->failedForNonExistingServiceConsoleApp ();
145- $ input = new ArrayInput (array ('command ' =>'command:ordinary -with-service-dependency ' , 'name ' => 'world ' ));
147+ $ input = new ArrayInput (array ('command ' =>'command:greeting -with-service-dependency ' , 'name ' => 'world ' ));
146148 $ cli = Console \ApplicationFactory::makeApplication ($ this ->container , 'TestApp ' , '1.0.1 ' );
147149 $ cli ->setAutoExit (false );
148150 $ this ->assertEquals ('TestApp ' , $ cli ->getName ());
0 commit comments