1 year ago

Loading A relationship collection

Posted 1 year ago by xtremer360

I'm trying to test that a collection of past events are loaded to be shown in the view for a venue. As of right now with the code blocks below regardless if the first line of the show method is commented OR not the test passes. Should this be a concern for me?

* Display the specified venue.
* @param  Venue $venue
* @return \Illuminate\Http\Response
public function show(Venue $venue)
    // $venue->load('pastEvents');

    return response()->view('venues.show', ['venue' => $venue]);
 /** @test */
public function venues_past_events_are_eager_loaded_for_venue_page()
    $response = $this->actingAs($this->authorizedUser)
                                     ->get(route('venues.show', $this->venue->id));



@foreach($venue->pastEvents as $event)

Please sign in or create an account to participate in this conversation.