File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,10 @@ public function testConnection()
66 {
77 $ connection = DB ::connection ('mongodb ' );
88 $ this ->assertInstanceOf ('Jenssegers\Mongodb\Connection ' , $ connection );
9+ }
910
11+ public function testReconnect ()
12+ {
1013 $ c1 = DB ::connection ('mongodb ' );
1114 $ c2 = DB ::connection ('mongodb ' );
1215 $ this ->assertEquals (spl_object_hash ($ c1 ), spl_object_hash ($ c2 ));
Original file line number Diff line number Diff line change @@ -57,6 +57,20 @@ public function testHasOne()
5757
5858 $ role = $ user ->role ;
5959 $ this ->assertEquals ('admin ' , $ role ->type );
60+ $ this ->assertEquals ($ user ->_id , $ role ->user_id );
61+
62+ $ user = User::create (array ('name ' => 'Jane Doe ' ));
63+ $ role = new Role (array ('type ' => 'user ' ));
64+ $ user ->role ()->save ($ role );
65+
66+ $ role = $ user ->role ;
67+ $ this ->assertEquals ('user ' , $ role ->type );
68+ $ this ->assertEquals ($ user ->_id , $ role ->user_id );
69+
70+ $ user = User::where ('name ' , 'Jane Doe ' )->first ();
71+ $ role = $ user ->role ;
72+ $ this ->assertEquals ('user ' , $ role ->type );
73+ $ this ->assertEquals ($ user ->_id , $ role ->user_id );
6074 }
6175
6276 public function testWithBelongsTo ()
You can’t perform that action at this time.
0 commit comments