|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Smoke test for the workspace worktree --base-branch CLI alias. |
| 3 | + * Smoke test for workspace worktree base-ref CLI aliases. |
4 | 4 | * |
5 | 5 | * php tests/smoke-worktree-base-branch-cli.php |
6 | 6 | * |
@@ -144,18 +144,36 @@ public function execute( array $input ): array |
144 | 144 | ); |
145 | 145 | datamachine_code_assert('upstream/develop' === $ability->last_input['from'], 'remote ref preserved'); |
146 | 146 |
|
147 | | - echo "\n[4] --from wins by rejecting ambiguous input\n"; |
| 147 | + echo "\n[4] --base aliases exact --from refs\n"; |
| 148 | + $command->worktree( |
| 149 | + array( 'add', 'data-machine', 'feat/test' ), |
| 150 | + array( 'base' => 'origin/main' ) |
| 151 | + ); |
| 152 | + datamachine_code_assert('origin/main' === $ability->last_input['from'], '--base forwards exact refs as from'); |
| 153 | + |
| 154 | + echo "\n[5] --from and --base reject ambiguous exact-base input\n"; |
| 155 | + try { |
| 156 | + $command->worktree( |
| 157 | + array( 'add', 'data-machine', 'feat/test' ), |
| 158 | + array( 'from' => 'origin/main', 'base' => 'upstream/develop' ) |
| 159 | + ); |
| 160 | + datamachine_code_assert(false, 'ambiguous exact-base flags should throw'); |
| 161 | + } catch ( RuntimeException $e ) { |
| 162 | + datamachine_code_assert(str_contains($e->getMessage(), 'not both'), 'ambiguous exact-base flags fail clearly'); |
| 163 | + } |
| 164 | + |
| 165 | + echo "\n[6] exact base flags reject ambiguous base-branch input\n"; |
148 | 166 | try { |
149 | 167 | $command->worktree( |
150 | 168 | array( 'add', 'data-machine', 'feat/test' ), |
151 | | - array( 'from' => 'origin/main', 'base-branch' => 'develop' ) |
| 169 | + array( 'base' => 'origin/main', 'base-branch' => 'develop' ) |
152 | 170 | ); |
153 | 171 | datamachine_code_assert(false, 'ambiguous flags should throw'); |
154 | 172 | } catch ( RuntimeException $e ) { |
155 | 173 | datamachine_code_assert(str_contains($e->getMessage(), 'not both'), 'ambiguous flags fail clearly'); |
156 | 174 | } |
157 | 175 |
|
158 | | - echo "\n[5] --force is forwarded for add and JSON output keeps disk budget\n"; |
| 176 | + echo "\n[7] --force is forwarded for add and JSON output keeps disk budget\n"; |
159 | 177 | \WP_CLI::reset_logs(); |
160 | 178 | $command->worktree( |
161 | 179 | array( 'add', 'data-machine', 'feat/test' ), |
|
0 commit comments