@@ -259,71 +259,4 @@ public function testBelongsToManyCustom()
259259 $ this ->assertEquals ($ group ->_id , $ user ->groups ()->first ()->_id );
260260 $ this ->assertEquals ($ user ->_id , $ group ->users ()->first ()->_id );
261261 }
262-
263- public function testMysqlModel ()
264- {
265- // A bit dirty
266- MysqlUser::executeSchema ();
267- MysqlBook::executeSchema ();
268- MysqlRole::executeSchema ();
269-
270- $ user = new MysqlUser ;
271- $ this ->assertInstanceOf ('MysqlUser ' , $ user );
272- $ this ->assertInstanceOf ('Illuminate\Database\MySqlConnection ' , $ user ->getConnection ());
273-
274- // Mysql User
275- $ user ->name = "John Doe " ;
276- $ user ->save ();
277- $ this ->assertTrue (is_int ($ user ->id ));
278-
279- // SQL has many
280- $ book = new Book (array ('title ' => 'Game of Thrones ' ));
281- $ user ->books ()->save ($ book );
282- $ user = MysqlUser::find ($ user ->id ); // refetch
283- $ this ->assertEquals (1 , count ($ user ->books ));
284-
285- // MongoDB belongs to
286- $ book = $ user ->books ()->first (); // refetch
287- $ this ->assertEquals ('John Doe ' , $ book ->mysqlAuthor ->name );
288-
289- // SQL has one
290- $ role = new Role (array ('type ' => 'admin ' ));
291- $ user ->role ()->save ($ role );
292- $ user = MysqlUser::find ($ user ->id ); // refetch
293- $ this ->assertEquals ('admin ' , $ user ->role ->type );
294-
295- // MongoDB beelongs to
296- $ role = $ user ->role ()->first (); // refetch
297- $ this ->assertEquals ('John Doe ' , $ role ->mysqlUser ->name );
298-
299- // MongoDB User
300- $ user = new User ;
301- $ user ->name = "John Doe " ;
302- $ user ->save ();
303-
304- // MongoDB has many
305- $ book = new MysqlBook (array ('title ' => 'Game of Thrones ' ));
306- $ user ->mysqlBooks ()->save ($ book );
307- $ user = User::find ($ user ->_id ); // refetch
308- $ this ->assertEquals (1 , count ($ user ->mysqlBooks ));
309-
310- // SQL belongs to
311- $ book = $ user ->mysqlBooks ()->first (); // refetch
312- $ this ->assertEquals ('John Doe ' , $ book ->author ->name );
313-
314- // MongoDB has one
315- $ role = new MysqlRole (array ('type ' => 'admin ' ));
316- $ user ->mysqlRole ()->save ($ role );
317- $ user = User::find ($ user ->_id ); // refetch
318- $ this ->assertEquals ('admin ' , $ user ->mysqlRole ->type );
319-
320- // SQL belongs to
321- $ role = $ user ->mysqlRole ()->first (); // refetch
322- $ this ->assertEquals ('John Doe ' , $ role ->user ->name );
323-
324- // Dirty again :)
325- MysqlUser::truncate ();
326- MysqlBook::truncate ();
327- MysqlRole::truncate ();
328- }
329262}
0 commit comments