File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
src/Illuminate/Database/Eloquent
tests/Integration/Database Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ public function create(array $attributes = [])
153
153
$ this ->store ($ results );
154
154
}
155
155
156
- return $ results ;
156
+ return $ results-> fresh () ;
157
157
}
158
158
159
159
/**
Original file line number Diff line number Diff line change @@ -180,7 +180,9 @@ public function creating_models_on_custom_connection()
180
180
$ this ->assertTrue ($ user ->is ($ dbUser ));
181
181
}
182
182
183
- /** @test */
183
+ /**
184
+ * @test
185
+ */
184
186
public function making_models_with_a_custom_connection ()
185
187
{
186
188
$ user = factory (FactoryBuildableUser::class)
@@ -189,6 +191,16 @@ public function making_models_with_a_custom_connection()
189
191
190
192
$ this ->assertEquals ('alternative-connection ' , $ user ->getConnectionName ());
191
193
}
194
+
195
+ /**
196
+ * @test
197
+ */
198
+ public function creating_model_returns_fresh_instance ()
199
+ {
200
+ $ user = factory (FactoryBuildableUser::class)->create ();
201
+
202
+ $ this ->assertEquals (1 , $ user ->field_with_default );
203
+ }
192
204
}
193
205
194
206
class FactoryBuildableUser extends Model
You can’t perform that action at this time.
0 commit comments