comparison src/Replacer/Replacer.php @ 37:116b36f5e73b ls_dev_2025_09

Adding support for tests. It's pretty basic but we can improve later.
author Luka Sitas <sitas.luka.97@gmail.com>
date Thu, 25 Sep 2025 19:58:01 -0400
parents 55d2e5c5dad9
children
comparison
equal deleted inserted replaced
36:76584181267a 37:116b36f5e73b
163 public function factory_name(string $name): string 163 public function factory_name(string $name): string
164 { 164 {
165 return Str::singular(Str::studly($name)) . 'Factory'; 165 return Str::singular(Str::studly($name)) . 'Factory';
166 } 166 }
167 167
168 /**
169 * Generate test name in Studly case.
170 */
171 public function test_name(string $name): string
172 {
173 return Str::singular(Str::studly($name)) . 'Test';
174 }
175
168 // Namespace Methods 176 // Namespace Methods
169 // These methods handle the formation of various namespaces used within the replacements. 177 // These methods handle the formation of various namespaces used within the replacements.
170 178
171 /** 179 /**
172 * Get the root namespace for the application. 180 * Get the root namespace for the application.
280 */ 288 */
281 public function getFactoryNamespace(string $name = ''): string 289 public function getFactoryNamespace(string $name = ''): string
282 { 290 {
283 return database_path() 291 return database_path()
284 . DIRECTORY_SEPARATOR . 'factories' ; 292 . DIRECTORY_SEPARATOR . 'factories' ;
293 }
294
295 /**
296 * Get the test namespace.
297 */
298 public function getTestNamespace(string $name = ''): string
299 {
300 return base_path()
301 . DIRECTORY_SEPARATOR . 'tests'
302 . DIRECTORY_SEPARATOR . 'CRUD' ;
285 } 303 }
286 304
287 /** 305 /**
288 * Get the request uses string for replacement. 306 * Get the request uses string for replacement.
289 */ 307 */