prepareDatabase([ 'discussions' => [ ['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 1, 'comment_count' => 1], ], 'posts' => [ ['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '

foo bar

'], ], 'users' => [ $this->normalUser(), ] ]); } /** * @test */ public function shows_index_for_guest() { $response = $this->send( $this->request('GET', '/api/discussions') ); $this->assertEquals(200, $response->getStatusCode()); $data = json_decode($response->getBody()->getContents(), true); $this->assertEquals(1, count($data['data'])); } /** * @test */ public function can_search_for_author() { $response = $this->send( $this->request('GET', '/api/discussions') ->withQueryParams([ 'filter' => ['q' => 'author:normal foo'], 'include' => 'mostRelevantPost', ]) ); $this->assertEquals(200, $response->getStatusCode()); } }