11<?php
22namespace webfiori \framework \test \cli ;
33
4- use webfiori \ file \ File ;
4+ use app \ database \ TestTable ;
55use webfiori \framework \WebFioriApp ;
66/**
77 * Description of TestCreateCommand
@@ -65,90 +65,8 @@ public function testCreate01() {
6565 }
6666
6767
68- /**
69- * @test
70- */
71- public function testCreateMiddleware00 () {
72- $ runner = $ runner = WebFioriApp::getRunner ();
73- $ runner ->setArgsVector ([
74- 'webfiori ' ,
75- 'create '
76- ]);
77- $ runner ->setInput ([
78- '4 ' ,
79- 'NewCoolMd ' ,
80- 'app\middleware ' ,
81- 'Check is authorized ' ,
82- '22 ' ,
83- '' ,
84- '' ,
85- ]);
86-
87- $ this ->assertEquals (0 , $ runner ->start ());
88- $ this ->assertEquals ([
89- "What would you like to create? \n" ,
90- "0: Database table class. \n" ,
91- "1: Entity class from table. \n" ,
92- "2: Web service. \n" ,
93- "3: Background job. \n" ,
94- "4: Middleware. \n" ,
95- "5: CLI Command. \n" ,
96- "6: Theme. \n" ,
97- "7: Database access class based on table. \n" ,
98- "8: Complete REST backend (Database table, entity, database access and web services). \n" ,
99- "9: Quit. <-- \n" ,
100- "Enter a name for the new class: \n" ,
101- "Enter an optional namespace for the class: Enter = 'app\middleware' \n" ,
102- "Enter a name for the middleware: \n" ,
103- "Enter middleware priority: Enter = '0' \n" ,
104- "Would you like to add the middleware to a group?(y/N) \n" ,
105- 'Info: New class was created at " ' .ROOT_DIR .DS .'app ' .DS ."middleware \". \n" ,
106- ], $ runner ->getOutput ());
107- $ this ->assertTrue (class_exists ('\\app \\middleware \\NewCoolMdMiddleware ' ));
108- $ this ->removeClass ('\\app \\middleware \\NewCoolMdMiddleware ' );
109- }
110- /**
111- * @test
112- */
113- public function testCreateCommand00 () {
114- $ runner = $ runner = WebFioriApp::getRunner ();
115- $ runner ->setArgsVector ([
116- 'webfiori ' ,
117- 'create '
118- ]);
119- $ runner ->setInput ([
120- '5 ' ,
121- 'NewCLI ' ,
122- 'app\commands ' ,
123- 'print-hello ' ,
124- 'Prints \'Hello World \' in the console. ' ,
125- 'N ' ,
126- '' ,
127- ]);
128-
129- $ this ->assertEquals (0 , $ runner ->start ());
130- $ this ->assertEquals ([
131- "What would you like to create? \n" ,
132- "0: Database table class. \n" ,
133- "1: Entity class from table. \n" ,
134- "2: Web service. \n" ,
135- "3: Background job. \n" ,
136- "4: Middleware. \n" ,
137- "5: CLI Command. \n" ,
138- "6: Theme. \n" ,
139- "7: Database access class based on table. \n" ,
140- "8: Complete REST backend (Database table, entity, database access and web services). \n" ,
141- "9: Quit. <-- \n" ,
142- "Enter a name for the new class: \n" ,
143- "Enter an optional namespace for the class: Enter = 'app\commands' \n" ,
144- "Enter a name for the command: \n" ,
145- "Give a short description of the command: \n" ,
146- "Would you like to add arguments to the command?(y/N) \n" ,
147- 'Info: New class was created at " ' .ROOT_DIR .DS .'app ' .DS ."commands \". \n" ,
148- ], $ runner ->getOutput ());
149- $ this ->assertTrue (class_exists ('\\app \\commands \\NewCLICommand ' ));
150- $ this ->removeClass ('\\app \\commands \\NewCLICommand ' );
151- }
68+
69+
15270 /**
15371 * @test
15472 */
@@ -212,7 +130,7 @@ public function testCreateWebService00() {
212130 "Success: New parameter added to the service 'get-hello'. \n" ,
213131 "Would you like to add another parameter?(y/N) \n" ,
214132 "Creating the class... \n" ,
215- 'Info: New class was created at " ' .ROOT_DIR .DS .'app ' .DS ."apis \". \n" ,
133+ 'Info: New class was created at " ' .ROOT_PATH .DS .'app ' .DS ."apis \". \n" ,
216134 "Info: Don't forget to add the service to a services manager. \n" ,
217135 ], $ runner ->getOutput ());
218136 $ this ->assertTrue (class_exists ('\\app \\apis \\NewWebService ' ));
@@ -239,7 +157,7 @@ public function testCreateEntity00() {
239157 'webfiori ' ,
240158 'create ' ,
241159 '--c ' => 'entity ' ,
242- '--table ' => \ app \ database \ TestTable::class
160+ '--table ' => TestTable::class
243161 ]);
244162 $ this ->assertEquals (0 , $ runner ->start ());
245163 $ this ->assertEquals ([
@@ -286,7 +204,7 @@ public function testCreateEntity01() {
286204 'webfiori ' ,
287205 'create ' ,
288206 '--c ' => 'entiy ' ,
289- '--table ' => \ app \ database \ TestTable::class
207+ '--table ' => TestTable::class
290208 ]);
291209 $ this ->assertEquals (0 , $ runner ->start ());
292210 $ this ->assertEquals ([
0 commit comments