@@ -185,6 +185,35 @@ public function using_ulids_output_also_creates_pivot_table_migration(): void
185
185
$ this ->assertEquals (['created ' => [$ journey_model_migration , $ diary_model_migration , $ pivot_migration ]], $ this ->subject ->output ($ tree ));
186
186
}
187
187
188
+ #[Test]
189
+ public function using_alias_output_also_aliases_pivot_table_migration (): void
190
+ {
191
+ $ this ->filesystem ->expects ('stub ' )
192
+ ->with ('migration.stub ' )
193
+ ->andReturn ($ this ->stub ('migration.stub ' ));
194
+
195
+ $ now = Carbon::now ();
196
+ Carbon::setTestNow ($ now );
197
+
198
+ $ journey_model_migration = str_replace ('timestamp ' , $ now ->copy ()->subSeconds (2 )->format ('Y_m_d_His ' ), 'database/migrations/timestamp_create_customers_table.php ' );
199
+ $ diary_model_migration = str_replace ('timestamp ' , $ now ->copy ()->subSecond ()->format ('Y_m_d_His ' ), 'database/migrations/timestamp_create_pets_table.php ' );
200
+ $ pivot_migration = str_replace ('timestamp ' , $ now ->format ('Y_m_d_His ' ), 'database/migrations/timestamp_create_customer_pet_table.php ' );
201
+
202
+ $ this ->filesystem ->expects ('exists ' )->times (3 )->andReturn (false );
203
+
204
+ $ this ->filesystem ->expects ('put ' )
205
+ ->with ($ journey_model_migration , $ this ->fixture ('migrations/belongs-to-many-alias-customers.php ' ));
206
+ $ this ->filesystem ->expects ('put ' )
207
+ ->with ($ diary_model_migration , $ this ->fixture ('migrations/belongs-to-many-alias-pets.php ' ));
208
+ $ this ->filesystem ->expects ('put ' )
209
+ ->with ($ pivot_migration , $ this ->fixture ('migrations/belongs-to-many-alias-customer-pet.php ' ));
210
+
211
+ $ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/belongs-to-many-using-alias.yaml ' ));
212
+ $ tree = $ this ->blueprint ->analyze ($ tokens );
213
+
214
+ $ this ->assertEquals (['created ' => [$ journey_model_migration , $ diary_model_migration , $ pivot_migration ]], $ this ->subject ->output ($ tree ));
215
+ }
216
+
188
217
#[Test]
189
218
public function output_also_creates_pivot_table_migration (): void
190
219
{
@@ -367,32 +396,6 @@ public function output_does_not_duplicate_pivot_table_migration(): void
367
396
$ this ->assertEquals (['created ' => [$ company_migration , $ people_migration , $ pivot_migration ]], $ this ->subject ->output ($ tree ));
368
397
}
369
398
370
- #[Test]
371
- public function output_also_creates_pivot_table_migration_with_custom_name (): void
372
- {
373
- $ this ->filesystem ->expects ('stub ' )
374
- ->with ('migration.stub ' )
375
- ->andReturn ($ this ->stub ('migration.stub ' ));
376
-
377
- $ now = Carbon::now ();
378
- Carbon::setTestNow ($ now );
379
-
380
- $ model_migration = str_replace ('timestamp ' , $ now ->copy ()->subSecond ()->format ('Y_m_d_His ' ), 'database/migrations/timestamp_create_users_table.php ' );
381
- $ pivot_migration = str_replace ('timestamp ' , $ now ->format ('Y_m_d_His ' ), 'database/migrations/timestamp_create_test_table.php ' );
382
-
383
- $ this ->filesystem ->expects ('exists ' )->twice ()->andReturn (false );
384
-
385
- $ this ->filesystem ->expects ('put ' )
386
- ->with ($ model_migration , $ this ->fixture ('migrations/custom-pivot-table-name-user.php ' ));
387
- $ this ->filesystem ->expects ('put ' )
388
- ->with ($ pivot_migration , $ this ->fixture ('migrations/custom-pivot-table-name-test.php ' ));
389
-
390
- $ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/custom-pivot-table-name.yaml ' ));
391
- $ tree = $ this ->blueprint ->analyze ($ tokens );
392
-
393
- $ this ->assertEquals (['created ' => [$ model_migration , $ pivot_migration ]], $ this ->subject ->output ($ tree ));
394
- }
395
-
396
399
#[Test]
397
400
public function output_creates_pivot_table_migration_correctly_when_model_name_contains_path_prefix (): void
398
401
{
0 commit comments