@@ -55,7 +55,7 @@ public function output_writes_migration_for_model_tree($definition, $path, $migr
55
55
->andReturn (file_get_contents ('stubs/factory.stub ' ));
56
56
57
57
$ this ->files ->expects ('exists ' )
58
- ->with (dirname ( $ path ) )
58
+ ->with (' database/factories ' )
59
59
->andReturnTrue ();
60
60
61
61
$ this ->files ->expects ('put ' )
@@ -81,9 +81,7 @@ public function output_respects_configuration()
81
81
82
82
$ this ->files ->expects ('exists ' )
83
83
->with ('database/factories ' )
84
- ->andReturnFalse ();
85
- $ this ->files ->expects ('makeDirectory ' )
86
- ->with ('database/factories ' , 0755 , true );
84
+ ->andReturnTrue ();
87
85
88
86
$ this ->files ->expects ('put ' )
89
87
->with ('database/factories/PostFactory.php ' , $ this ->fixture ('factories/post-configured.php ' ));
@@ -94,14 +92,37 @@ public function output_respects_configuration()
94
92
$ this ->assertEquals (['created ' => ['database/factories/PostFactory.php ' ]], $ this ->subject ->output ($ tree ));
95
93
}
96
94
95
+ /**
96
+ * @test
97
+ */
98
+ public function output_creates_directory_for_nested_components ()
99
+ {
100
+ $ this ->files ->expects ('stub ' )
101
+ ->with ('factory.stub ' )
102
+ ->andReturn (file_get_contents ('stubs/factory.stub ' ));
103
+
104
+ $ this ->files ->expects ('exists ' )
105
+ ->with ('database/factories/Admin ' )
106
+ ->andReturnFalse ();
107
+ $ this ->files ->expects ('makeDirectory ' )
108
+ ->with ('database/factories/Admin ' , 0755 , true );
109
+
110
+ $ this ->files ->expects ('put ' )
111
+ ->with ('database/factories/Admin/UserFactory.php ' , $ this ->fixture ('factories/nested-components.php ' ));
112
+
113
+ $ tokens = $ this ->blueprint ->parse ($ this ->fixture ('definitions/nested-components.bp ' ));
114
+ $ tree = $ this ->blueprint ->analyze ($ tokens );
115
+
116
+ $ this ->assertEquals (['created ' => ['database/factories/Admin/UserFactory.php ' ]], $ this ->subject ->output ($ tree ));
117
+ }
118
+
97
119
public function modelTreeDataProvider ()
98
120
{
99
121
return [
100
122
['definitions/phone.bp ' , 'database/factories/PhoneFactory.php ' , 'factories/phone.php ' ],
101
123
['definitions/post.bp ' , 'database/factories/PostFactory.php ' , 'factories/post.php ' ],
102
124
['definitions/team.bp ' , 'database/factories/TeamFactory.php ' , 'factories/team.php ' ],
103
125
['definitions/unconventional.bp ' , 'database/factories/TeamFactory.php ' , 'factories/unconventional.php ' ],
104
- ['definitions/nested-components.bp ' , 'database/factories/Admin/UserFactory.php ' , 'factories/nested-components.php ' ],
105
126
['definitions/model-modifiers.bp ' , 'database/factories/ModifierFactory.php ' , 'factories/model-modifiers.php ' ],
106
127
['definitions/model-key-constraints.bp ' , 'database/factories/OrderFactory.php ' , 'factories/model-key-constraints.php ' ]
107
128
];
0 commit comments