@@ -32,43 +32,73 @@ public function testRun() : void
3232        ]);
3333
3434        $ command  = new  RouteListCommand ($ router );
35-         $ commandTester  = new  CommandTester ($ command );
3635
37-         $ exitCode  = $ commandTester ->execute ([]);
36+         $ this  ->assertSame ('router:route-list ' , $ command ->getName ());
37+ 
38+         $ commandTester  = new  CommandTester ($ command );
3839
39-         $ this  ->assertSame (0 , $ exitCode  );
40+         $ this  ->assertSame (0 , $ commandTester -> execute ([]) );
4041    }
4142
4243    /** 
4344     * @return void 
4445     */ 
45-     public  function  testRunWithoutRouter () : void 
46+     public  function  testRunInheritedCommand () : void 
4647    {
47-         $ command  = new  RouteListCommand ();
48-         $ commandTester  = new  CommandTester ($ command );
48+         $ command  = new  class  extends  RouteListCommand
49+         {
50+             public  function  __construct ()
51+             {
52+                 parent ::__construct (null );
53+             }
4954
50-         $ this  ->expectException (RuntimeException::class);
55+             protected  function  getRouter () : Router 
56+             {
57+                 return  new  Router ();
58+             }
59+         };
5160
52-         $ commandTester ->execute ([]);
61+         $ this  ->assertSame ('router:route-list ' , $ command ->getName ());
62+ 
63+         $ commandTester  = new  CommandTester ($ command );
64+ 
65+         $ this  ->assertSame (0 , $ commandTester ->execute ([]));
5366    }
5467
5568    /** 
5669     * @return void 
5770     */ 
58-     public  function  testRunInheritedCommand () : void 
71+     public  function  testRunRenamedCommand () : void 
5972    {
60-         $ userCommand   = new  class  extends  RouteListCommand
73+         $ command   = new  class  extends  RouteListCommand
6174        {
62-             protected  function  getRouter () : Router 
75+             protected  static  $ defaultName  = 'foo ' ;
76+             protected  static  $ defaultDescription  = 'bar ' ;
77+ 
78+             public  function  __construct ()
6379            {
64-                 return   new  Router ();
80+                 parent :: __construct ( new  Router () );
6581            }
6682        };
6783
68-         $ commandTester  = new  CommandTester ($ userCommand );
84+         $ this  ->assertSame ('foo ' , $ command ->getName ());
85+         $ this  ->assertSame ('bar ' , $ command ->getDescription ());
6986
70-         $ exitCode  = $ commandTester ->execute ([]);
87+         $ commandTester  = new  CommandTester ($ command );
88+ 
89+         $ this  ->assertSame (0 , $ commandTester ->execute ([]));
90+     }
7191
72-         $ this  ->assertSame (0 , $ exitCode );
92+     /** 
93+      * @return void 
94+      */ 
95+     public  function  testRunWithoutRouter () : void 
96+     {
97+         $ command  = new  RouteListCommand ();
98+         $ commandTester  = new  CommandTester ($ command );
99+ 
100+         $ this  ->expectException (RuntimeException::class);
101+ 
102+         $ commandTester ->execute ([]);
73103    }
74104}
0 commit comments