Mercurial > packages > magicforger
comparison src/Generator/Generator.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 | 76584181267a |
| children | c062f013fd19 |
comparison
equal
deleted
inserted
replaced
| 36:76584181267a | 37:116b36f5e73b |
|---|---|
| 80 } | 80 } |
| 81 | 81 |
| 82 if ($this->option('route')) { | 82 if ($this->option('route')) { |
| 83 $this->createRoute(); | 83 $this->createRoute(); |
| 84 } | 84 } |
| 85 | |
| 86 if ($this->option('test')) { | |
| 87 $this->createTest(); | |
| 88 } | |
| 85 } | 89 } |
| 86 | 90 |
| 87 /** | 91 /** |
| 88 * Get the console command options. | 92 * Get the console command options. |
| 89 */ | 93 */ |
| 94 ['controller', 'c', InputOption::VALUE_NONE, 'Generate a controller class for the table.'], | 98 ['controller', 'c', InputOption::VALUE_NONE, 'Generate a controller class for the table.'], |
| 95 ['model', 'm', InputOption::VALUE_NONE, 'Generate a model class for the table.'], | 99 ['model', 'm', InputOption::VALUE_NONE, 'Generate a model class for the table.'], |
| 96 ['request', 'r', InputOption::VALUE_NONE, 'Generate base request classes for the table.'], | 100 ['request', 'r', InputOption::VALUE_NONE, 'Generate base request classes for the table.'], |
| 97 ['view', '', InputOption::VALUE_NONE, 'Generate base views for the table.'], | 101 ['view', '', InputOption::VALUE_NONE, 'Generate base views for the table.'], |
| 98 ['route', 'w', InputOption::VALUE_NONE, 'Generate base routes classes for the table.'], | 102 ['route', 'w', InputOption::VALUE_NONE, 'Generate base routes classes for the table.'], |
| 99 ['factory', 'f', InputOption::VALUE_NONE, 'Generate base factory classes for the table.'], | 103 ['factory', 'F', InputOption::VALUE_NONE, 'Generate base factory classes for the table.'], |
| 104 ['test', 't', InputOption::VALUE_NONE, 'Generate base test classes for the table.'], | |
| 100 ]); | 105 ]); |
| 101 } | 106 } |
| 102 | 107 |
| 103 /** | 108 /** |
| 104 * Interact further with the user if they were prompted for missing arguments. | 109 * Interact further with the user if they were prompted for missing arguments. |
| 134 | 139 |
| 135 protected function createFactory() | 140 protected function createFactory() |
| 136 { | 141 { |
| 137 $this->call('mf:factory', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); | 142 $this->call('mf:factory', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); |
| 138 } | 143 } |
| 144 | |
| 145 protected function createTest() | |
| 146 { | |
| 147 $this->call('mf:test', ['table' => $this->getTableInput(), '--fresh' => $this->option('fresh')]); | |
| 148 } | |
| 139 } | 149 } |
