@@ -178,6 +178,9 @@ public function testCreate()
178178 $ this ->assertInstanceOf ('Jenssegers\Mongodb\Model ' , $ user );
179179 $ this ->assertEquals (true , $ user ->exists );
180180 $ this ->assertEquals ('Jane Poe ' , $ user ->name );
181+
182+ $ check = User::where ('name ' , 'Jane Poe ' )->first ();
183+ $ this ->assertEquals ($ user , $ check );
181184 }
182185
183186 public function testDestroy ()
@@ -280,6 +283,14 @@ public function testToArray()
280283 $ items = Item::all ();
281284 $ this ->assertEquals ($ original , $ items ->toArray ());
282285 $ this ->assertEquals ($ original [0 ], $ items [0 ]->toArray ());
286+
287+ // with date
288+ $ item = Item::create (array ('name ' => 'fork ' , 'type ' => 'sharp ' ));
289+ $ array = $ item ->toArray ();
290+ $ this ->assertTrue (array_key_exists ('created_at ' , $ array ));
291+ $ this ->assertTrue (array_key_exists ('updated_at ' , $ array ));
292+ $ this ->assertTrue (is_string ($ array ['created_at ' ]));
293+ $ this ->assertTrue (is_string ($ array ['updated_at ' ]));
283294 }
284295
285296 public function testUnset ()
@@ -312,14 +323,11 @@ public function testUnset()
312323 public function testDates ()
313324 {
314325 $ user = User::create (array ('name ' => 'John Doe ' , 'birthday ' => new DateTime ('1980/1/1 ' )));
315-
316326 $ this ->assertInstanceOf ('Carbon\Carbon ' , $ user ->birthday );
317327
318328 $ check = User::find ($ user ->_id );
319-
320329 $ this ->assertInstanceOf ('Carbon\Carbon ' , $ check ->birthday );
321330 $ this ->assertEquals ($ user ->birthday , $ check ->birthday );
322-
323331
324332 $ user = User::where ('birthday ' , '> ' , new DateTime ('1975/1/1 ' ))->first ();
325333 $ this ->assertEquals ('John Doe ' , $ user ->name );
0 commit comments