File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -275,15 +275,15 @@ public function testMorph()
275275 $ this ->assertEquals (1 , $ user ->photos ->count ());
276276 $ this ->assertEquals ($ photo ->id , $ user ->photos ->first ()->id );
277277
278- $ photo = Photo::create (array ('url ' => 'http://graph.facebook.com/john .doe/picture ' ));
279- $ client ->photos ()->save ($ photo );
278+ $ photo = Photo::create (array ('url ' => 'http://graph.facebook.com/jane .doe/picture ' ));
279+ $ client ->photo ()->save ($ photo );
280280
281- $ this ->assertEquals ( 1 , $ client ->photos -> count () );
282- $ this ->assertEquals ($ photo ->id , $ client ->photos -> first () ->id );
281+ $ this ->assertNotNull ( $ client ->photo );
282+ $ this ->assertEquals ($ photo ->id , $ client ->photo ->id );
283283
284284 $ client = Client::find ($ client ->_id );
285- $ this ->assertEquals ( 1 , $ client ->photos -> count () );
286- $ this ->assertEquals ($ photo ->id , $ client ->photos -> first () ->id );
285+ $ this ->assertNotNull ( $ client ->photo );
286+ $ this ->assertEquals ($ photo ->id , $ client ->photo ->id );
287287
288288 $ photo = Photo::first ();
289289 $ this ->assertEquals ($ photo ->imageable ->name , $ user ->name );
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ public function users()
1212 return $ this ->belongsToMany ('User ' );
1313 }
1414
15- public function photos ()
15+ public function photo ()
1616 {
17- return $ this ->morphMany ('Photo ' , 'imageable ' );
17+ return $ this ->morphOne ('Photo ' , 'imageable ' );
1818 }
1919}
You can’t perform that action at this time.
0 commit comments