File tree 2 files changed +8
-8
lines changed
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -275,15 +275,15 @@ public function testMorph()
275
275
$ this ->assertEquals (1 , $ user ->photos ->count ());
276
276
$ this ->assertEquals ($ photo ->id , $ user ->photos ->first ()->id );
277
277
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 );
280
280
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 );
283
283
284
284
$ 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 );
287
287
288
288
$ photo = Photo::first ();
289
289
$ this ->assertEquals ($ photo ->imageable ->name , $ user ->name );
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ public function users()
12
12
return $ this ->belongsToMany ('User ' );
13
13
}
14
14
15
- public function photos ()
15
+ public function photo ()
16
16
{
17
- return $ this ->morphMany ('Photo ' , 'imageable ' );
17
+ return $ this ->morphOne ('Photo ' , 'imageable ' );
18
18
}
19
19
}
You can’t perform that action at this time.
0 commit comments