@@ -213,4 +213,36 @@ public function it_can_keep_both_with_timestamp_strategy(): void
213213 $ this ->assertEquals ('existing ' , Storage::disk ('test ' )->get ('target/logo.svg ' ));
214214 $ this ->assertEquals ('new ' , Storage::disk ('test ' )->get ('target/logo-1712000000.svg ' ));
215215 }
216+
217+ #[Test]
218+ public function it_does_not_add_index_suffix_to_first_conflicting_asset_in_batch_with_non_conflicting_assets_before_it (): void
219+ {
220+ Carbon::setTestNow (Carbon::createFromTimestamp (1712000000 , config ('app.timezone ' )));
221+
222+ $ this ->createAsset ('source/a.svg ' , 'a-new ' );
223+ $ this ->createAsset ('source/logo.svg ' , 'new ' );
224+ $ this ->createAsset ('target/logo.svg ' , 'existing ' );
225+
226+ $ this
227+ ->actingAs (tap (User::make ()->makeSuper ())->save ())
228+ ->post (cp_route ('assets.actions.run ' ), [
229+ 'action ' => 'move_asset ' ,
230+ 'context ' => ['container ' => 'test_container ' , 'conflict ' => 'timestamp ' ],
231+ 'selections ' => ['test_container::source/a.svg ' , 'test_container::source/logo.svg ' ],
232+ 'values ' => ['folder ' => 'target ' ],
233+ ])
234+ ->assertOk ()
235+ ->assertJson ([
236+ 'success ' => true ,
237+ ]);
238+
239+ Storage::disk ('test ' )->assertMissing ('source/a.svg ' );
240+ Storage::disk ('test ' )->assertMissing ('source/logo.svg ' );
241+ Storage::disk ('test ' )->assertExists ('target/a.svg ' );
242+ Storage::disk ('test ' )->assertExists ('target/logo.svg ' );
243+ Storage::disk ('test ' )->assertExists ('target/logo-1712000000.svg ' );
244+ $ this ->assertEquals ('a-new ' , Storage::disk ('test ' )->get ('target/a.svg ' ));
245+ $ this ->assertEquals ('existing ' , Storage::disk ('test ' )->get ('target/logo.svg ' ));
246+ $ this ->assertEquals ('new ' , Storage::disk ('test ' )->get ('target/logo-1712000000.svg ' ));
247+ }
216248}
0 commit comments