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()
6
6
{
7
7
$ connection = DB ::connection ('mongodb ' );
8
8
$ this ->assertInstanceOf ('Jenssegers\Mongodb\Connection ' , $ connection );
9
+ }
9
10
11
+ public function testReconnect ()
12
+ {
10
13
$ c1 = DB ::connection ('mongodb ' );
11
14
$ c2 = DB ::connection ('mongodb ' );
12
15
$ 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()
57
57
58
58
$ role = $ user ->role ;
59
59
$ 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 );
60
74
}
61
75
62
76
public function testWithBelongsTo ()
You can’t perform that action at this time.
0 commit comments