@@ -111,8 +111,8 @@ public function output_works_for_pascal_case_definition()
111
111
->andReturn ($ this ->stub ('model.method.stub ' ))
112
112
->twice ();
113
113
114
- $ certificateModel = 'app/Certificate.php ' ;
115
- $ certificateTypeModel = 'app/CertificateType.php ' ;
114
+ $ certificateModel = 'app/Models/ Certificate.php ' ;
115
+ $ certificateTypeModel = 'app/Models/ CertificateType.php ' ;
116
116
117
117
$ this ->filesystem ->expects ('exists ' )
118
118
->with (dirname ($ certificateModel ))
@@ -151,15 +151,15 @@ public function output_generates_relationships()
151
151
->andReturn ($ this ->stub ('model.method.stub ' ));
152
152
153
153
$ this ->filesystem ->expects ('exists ' )
154
- ->with ('app ' )
154
+ ->with ('app/Models ' )
155
155
->andReturnTrue ();
156
156
$ this ->filesystem ->expects ('put ' )
157
- ->with ('app/Subscription.php ' , $ this ->fixture ('models/model-relationships.php ' ));
157
+ ->with ('app/Models/ Subscription.php ' , $ this ->fixture ('models/model-relationships.php ' ));
158
158
159
159
$ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/model-relationships.yaml ' ));
160
160
$ tree = $ this ->blueprint ->analyze ($ tokens );
161
161
162
- $ this ->assertEquals (['created ' => ['app/Subscription.php ' ]], $ this ->subject ->output ($ tree ));
162
+ $ this ->assertEquals (['created ' => ['app/Models/ Subscription.php ' ]], $ this ->subject ->output ($ tree ));
163
163
}
164
164
165
165
/**
@@ -181,16 +181,16 @@ public function output_generates_relationships_added_with_full_model_namespace()
181
181
->andReturn ($ this ->stub ('model.method.stub ' ));
182
182
183
183
$ this ->files ->expects ('exists ' )
184
- ->with ('app ' )
184
+ ->with ('app/Models ' )
185
185
->andReturnTrue ();
186
186
187
187
$ this ->files ->expects ('put ' )
188
- ->with ('app/Recurrency.php ' , $ this ->fixture ('models/model-relationships-with-full-namespace.php ' ));
188
+ ->with ('app/Models/ Recurrency.php ' , $ this ->fixture ('models/model-relationships-with-full-namespace.php ' ));
189
189
190
190
$ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/model-relationships-with-full-model-namespaces.yaml ' ));
191
191
$ tree = $ this ->blueprint ->analyze ($ tokens );
192
192
193
- $ this ->assertEquals (['created ' => ['app/Recurrency.php ' ]], $ this ->subject ->output ($ tree ));
193
+ $ this ->assertEquals (['created ' => ['app/Models/ Recurrency.php ' ]], $ this ->subject ->output ($ tree ));
194
194
}
195
195
196
196
/**
@@ -212,16 +212,16 @@ public function output_generates_morphone_morphmany_relation_string_when_using_f
212
212
->andReturn ($ this ->stub ('model.method.stub ' ));
213
213
214
214
$ this ->files ->expects ('exists ' )
215
- ->with ('app ' )
215
+ ->with ('app/Models ' )
216
216
->andReturnTrue ();
217
217
218
218
$ this ->files ->expects ('put ' )
219
- ->with ('app/Flag.php ' , $ this ->fixture ('models/model-relationships-morphone-morphmany-with-fqn.php ' ));
219
+ ->with ('app/Models/ Flag.php ' , $ this ->fixture ('models/model-relationships-morphone-morphmany-with-fqn.php ' ));
220
220
221
221
$ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/model-relationships-morphone-morphmany-with-fqn.yaml ' ));
222
222
$ tree = $ this ->blueprint ->analyze ($ tokens );
223
223
224
- $ this ->assertEquals (['created ' => ['app/Flag.php ' ]], $ this ->subject ->output ($ tree ));
224
+ $ this ->assertEquals (['created ' => ['app/Models/ Flag.php ' ]], $ this ->subject ->output ($ tree ));
225
225
}
226
226
227
227
/**
@@ -246,27 +246,27 @@ public function output_generates_polymorphic_relationships()
246
246
->andReturn ($ this ->stub ('model.method.stub ' ));
247
247
248
248
$ this ->filesystem ->expects ('exists ' )
249
- ->with ('app ' )
249
+ ->with ('app/Models ' )
250
250
->andReturnTrue ();
251
251
$ this ->filesystem ->expects ('put ' )
252
- ->with ('app/Post.php ' , $ this ->fixture ('models/post-polymorphic-relationship.php ' ));
252
+ ->with ('app/Models/ Post.php ' , $ this ->fixture ('models/post-polymorphic-relationship.php ' ));
253
253
254
254
$ this ->filesystem ->expects ('exists ' )
255
- ->with ('app ' )
255
+ ->with ('app/Models ' )
256
256
->andReturnTrue ();
257
257
$ this ->filesystem ->expects ('put ' )
258
- ->with ('app/User.php ' , $ this ->fixture ('models/user-polymorphic-relationship.php ' ));
258
+ ->with ('app/Models/ User.php ' , $ this ->fixture ('models/user-polymorphic-relationship.php ' ));
259
259
260
260
$ this ->filesystem ->expects ('exists ' )
261
- ->with ('app ' )
261
+ ->with ('app/Models ' )
262
262
->andReturnTrue ();
263
263
$ this ->filesystem ->expects ('put ' )
264
- ->with ('app/Image.php ' , $ this ->fixture ('models/image-polymorphic-relationship.php ' ));
264
+ ->with ('app/Models/ Image.php ' , $ this ->fixture ('models/image-polymorphic-relationship.php ' ));
265
265
266
266
$ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/polymorphic-relationships.yaml ' ));
267
267
$ tree = $ this ->blueprint ->analyze ($ tokens );
268
268
269
- $ this ->assertEquals (['created ' => ['app/Post.php ' , 'app/User.php ' , 'app/Image.php ' ]], $ this ->subject ->output ($ tree ));
269
+ $ this ->assertEquals (['created ' => ['app/Models/ Post.php ' , 'app/Models/ User.php ' , 'app/Models /Image.php ' ]], $ this ->subject ->output ($ tree ));
270
270
}
271
271
272
272
/**
@@ -292,27 +292,27 @@ public function output_generates_morphtomany_relationship_with_intermediate_mode
292
292
->andReturn ($ this ->stub ('model.method.stub ' ));
293
293
294
294
$ this ->filesystem ->expects ('exists ' )
295
- ->with ('app ' )
295
+ ->with ('app/Models ' )
296
296
->andReturnTrue ();
297
297
$ this ->filesystem ->expects ('put ' )
298
- ->with ('app/Post.php ' , $ this ->fixture ('models/post-many-to-many-polymorphic-relationship.php ' ));
298
+ ->with ('app/Models/ Post.php ' , $ this ->fixture ('models/post-many-to-many-polymorphic-relationship.php ' ));
299
299
300
300
$ this ->filesystem ->expects ('exists ' )
301
- ->with ('app ' )
301
+ ->with ('app/Models ' )
302
302
->andReturnTrue ();
303
303
$ this ->filesystem ->expects ('put ' )
304
- ->with ('app/Video.php ' , $ this ->fixture ('models/video-many-to-many-polymorphic-relationship.php ' ));
304
+ ->with ('app/Models/ Video.php ' , $ this ->fixture ('models/video-many-to-many-polymorphic-relationship.php ' ));
305
305
306
306
$ this ->filesystem ->expects ('exists ' )
307
- ->with ('app ' )
307
+ ->with ('app/Models ' )
308
308
->andReturnTrue ();
309
309
$ this ->filesystem ->expects ('put ' )
310
- ->with ('app/Tag.php ' , $ this ->fixture ('models/tag-many-to-many-polymorphic-relationship.php ' ));
310
+ ->with ('app/Models/ Tag.php ' , $ this ->fixture ('models/tag-many-to-many-polymorphic-relationship.php ' ));
311
311
312
312
$ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/many-to-many-polymorphic-relationships.yaml ' ));
313
313
$ tree = $ this ->blueprint ->analyze ($ tokens );
314
314
315
- $ this ->assertEquals (['created ' => ['app/Post.php ' , 'app/Video.php ' , 'app/Tag.php ' ]], $ this ->subject ->output ($ tree ));
315
+ $ this ->assertEquals (['created ' => ['app/Models/ Post.php ' , 'app/Models/ Video.php ' , 'app/Models /Tag.php ' ]], $ this ->subject ->output ($ tree ));
316
316
}
317
317
318
318
/**
@@ -337,15 +337,15 @@ public function output_generates_disabled_auto_columns()
337
337
->andReturn ($ this ->stub ('model.method.stub ' ));
338
338
339
339
$ this ->filesystem ->expects ('exists ' )
340
- ->with ('app ' )
340
+ ->with ('app/Models ' )
341
341
->andReturnTrue ();
342
342
$ this ->filesystem ->expects ('put ' )
343
- ->with ('app/State.php ' , $ this ->fixture ('models/disable-auto-columns.php ' ));
343
+ ->with ('app/Models/ State.php ' , $ this ->fixture ('models/disable-auto-columns.php ' ));
344
344
345
345
$ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/disable-auto-columns.yaml ' ));
346
346
$ tree = $ this ->blueprint ->analyze ($ tokens );
347
347
348
- $ this ->assertEquals (['created ' => ['app/State.php ' ]], $ this ->subject ->output ($ tree ));
348
+ $ this ->assertEquals (['created ' => ['app/Models/ State.php ' ]], $ this ->subject ->output ($ tree ));
349
349
}
350
350
351
351
/**
@@ -458,16 +458,16 @@ public function output_generates_models_with_guarded_property_when_config_option
458
458
->andReturn ($ this ->stub ('model.method.stub ' ));
459
459
460
460
$ this ->filesystem ->expects ('exists ' )
461
- ->with (dirname ('app/Comment.php ' ))
461
+ ->with (dirname ('app/Models/ Comment.php ' ))
462
462
->andReturnTrue ();
463
463
464
464
$ this ->filesystem ->expects ('put ' )
465
- ->with ('app/Comment.php ' , $ this ->fixture ('models/model-guarded.php ' ));
465
+ ->with ('app/Models/ Comment.php ' , $ this ->fixture ('models/model-guarded.php ' ));
466
466
467
467
$ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/model-guarded.yaml ' ));
468
468
$ tree = $ this ->blueprint ->analyze ($ tokens );
469
469
470
- $ this ->assertEquals (['created ' => ['app/Comment.php ' ]], $ this ->subject ->output ($ tree ));
470
+ $ this ->assertEquals (['created ' => ['app/Models/ Comment.php ' ]], $ this ->subject ->output ($ tree ));
471
471
}
472
472
473
473
/**
@@ -523,12 +523,12 @@ public function output_generates_models_with_namespaces_correctly()
523
523
*/
524
524
public function output_generates_models_with_custom_namespace_correctly ()
525
525
{
526
+ $ this ->app ['config ' ]->set ('blueprint.models_namespace ' , 'MyCustom ' );
527
+
526
528
$ definition = 'drafts/custom-models-namespace.yaml ' ;
527
- $ path = 'app/Models /Tag.php ' ;
529
+ $ path = 'app/MyCustom /Tag.php ' ;
528
530
$ model = 'models/custom-models-namespace.php ' ;
529
531
530
- $ this ->app ['config ' ]->set ('blueprint.models_namespace ' , 'Models ' );
531
-
532
532
$ this ->filesystem ->expects ('stub ' )
533
533
->with ($ this ->modelStub )
534
534
->andReturn ($ this ->stub ($ this ->modelStub ));
@@ -543,7 +543,7 @@ public function output_generates_models_with_custom_namespace_correctly()
543
543
->andReturn ($ this ->stub ('model.method.stub ' ));
544
544
545
545
$ this ->filesystem ->expects ('exists ' )
546
- ->with ('app/Models ' )
546
+ ->with ('app/MyCustom ' )
547
547
->andReturnTrue ();
548
548
$ this ->filesystem ->expects ('put ' )
549
549
->with ($ path , $ this ->fixture ($ model ));
@@ -576,42 +576,42 @@ public function output_generates_models_with_custom_pivot_columns()
576
576
->andReturn ($ this ->stub ('model.hidden.stub ' ));
577
577
578
578
$ this ->filesystem ->expects ('exists ' )
579
- ->with ('app ' )
579
+ ->with ('app/Models ' )
580
580
->andReturnTrue ();
581
581
$ this ->filesystem ->expects ('put ' )
582
- ->with ('app/User.php ' , $ this ->fixture ('models/custom-pivot-table-name.php ' ));
582
+ ->with ('app/Models/ User.php ' , $ this ->fixture ('models/custom-pivot-table-name.php ' ));
583
583
584
584
$ tokens = $ this ->blueprint ->parse ($ this ->fixture ('drafts/custom-pivot-table-name.yaml ' ));
585
585
$ tree = $ this ->blueprint ->analyze ($ tokens );
586
586
587
- $ this ->assertEquals (['created ' => ['app/User.php ' ]], $ this ->subject ->output ($ tree ));
587
+ $ this ->assertEquals (['created ' => ['app/Models/ User.php ' ]], $ this ->subject ->output ($ tree ));
588
588
}
589
589
590
590
public function modelTreeDataProvider ()
591
591
{
592
592
return [
593
- ['drafts/readme-example.yaml ' , 'app/Post.php ' , 'models/readme-example.php ' ],
594
- ['drafts/with-timezones.yaml ' , 'app/Comment.php ' , 'models/comment.php ' ],
595
- ['drafts/soft-deletes.yaml ' , 'app/Comment.php ' , 'models/soft-deletes.php ' ],
596
- ['drafts/relationships.yaml ' , 'app/Comment.php ' , 'models/relationships.php ' ],
597
- ['drafts/unconventional.yaml ' , 'app/Team.php ' , 'models/unconventional.php ' ],
598
- ['drafts/nested-components.yaml ' , 'app/Admin/User.php ' , 'models/nested-components.php ' ],
599
- ['drafts/resource-statements.yaml ' , 'app/User.php ' , 'models/resource-statements.php ' ],
600
- ['drafts/all-column-types.yaml ' , 'app/AllType.php ' , 'models/all-column-types.php ' ],
601
- ['drafts/alias-relationships.yaml ' , 'app/Salesman.php ' , 'models/alias-relationships.php ' ],
602
- ['drafts/return-type-declarations.yaml ' , 'app/Term.php ' , 'models/return-type-declarations.php ' ],
603
- ['drafts/uuid-shorthand-invalid-relationship.yaml ' , 'app/AgeCohort.php ' , 'models/uuid-shorthand-invalid-relationship.php ' ],
593
+ ['drafts/readme-example.yaml ' , 'app/Models/ Post.php ' , 'models/readme-example.php ' ],
594
+ ['drafts/with-timezones.yaml ' , 'app/Models/ Comment.php ' , 'models/comment.php ' ],
595
+ ['drafts/soft-deletes.yaml ' , 'app/Models/ Comment.php ' , 'models/soft-deletes.php ' ],
596
+ ['drafts/relationships.yaml ' , 'app/Models/ Comment.php ' , 'models/relationships.php ' ],
597
+ ['drafts/unconventional.yaml ' , 'app/Models/ Team.php ' , 'models/unconventional.php ' ],
598
+ ['drafts/nested-components.yaml ' , 'app/Models/ Admin/User.php ' , 'models/nested-components.php ' ],
599
+ ['drafts/resource-statements.yaml ' , 'app/Models/ User.php ' , 'models/resource-statements.php ' ],
600
+ ['drafts/all-column-types.yaml ' , 'app/Models/ AllType.php ' , 'models/all-column-types.php ' ],
601
+ ['drafts/alias-relationships.yaml ' , 'app/Models/ Salesman.php ' , 'models/alias-relationships.php ' ],
602
+ ['drafts/return-type-declarations.yaml ' , 'app/Models/ Term.php ' , 'models/return-type-declarations.php ' ],
603
+ ['drafts/uuid-shorthand-invalid-relationship.yaml ' , 'app/Models/ AgeCohort.php ' , 'models/uuid-shorthand-invalid-relationship.php ' ],
604
604
];
605
605
}
606
606
607
607
public function docBlockModelsDataProvider ()
608
608
{
609
609
return [
610
- ['drafts/readme-example.yaml ' , 'app/Post.php ' , 'models/readme-example-phpdoc.php ' ],
611
- ['drafts/soft-deletes.yaml ' , 'app/Comment.php ' , 'models/soft-deletes-phpdoc.php ' ],
612
- ['drafts/relationships.yaml ' , 'app/Comment.php ' , 'models/relationships-phpdoc.php ' ],
613
- ['drafts/disable-auto-columns.yaml ' , 'app/State.php ' , 'models/disable-auto-columns-phpdoc.php ' ],
614
- ['drafts/foreign-key-shorthand.yaml ' , 'app/Comment.php ' , 'models/foreign-key-shorthand-phpdoc.php ' ],
610
+ ['drafts/readme-example.yaml ' , 'app/Models/ Post.php ' , 'models/readme-example-phpdoc.php ' ],
611
+ ['drafts/soft-deletes.yaml ' , 'app/Models/ Comment.php ' , 'models/soft-deletes-phpdoc.php ' ],
612
+ ['drafts/relationships.yaml ' , 'app/Models/ Comment.php ' , 'models/relationships-phpdoc.php ' ],
613
+ ['drafts/disable-auto-columns.yaml ' , 'app/Models/ State.php ' , 'models/disable-auto-columns-phpdoc.php ' ],
614
+ ['drafts/foreign-key-shorthand.yaml ' , 'app/Models/ Comment.php ' , 'models/foreign-key-shorthand-phpdoc.php ' ],
615
615
];
616
616
}
617
617
}
0 commit comments