/** * Inserts an edition into an article and * then asserts the returned value * from the index property. **/ public function testRepositoryEditionAtIndexEditionReturned() { $edition = Scenario::prepareEdition(null, null, 'specific edition'); $returnedEdition = $this->repo->editionAtIndex($edition->article->id, $edition->id); $this->assertNotNull($returnedEdition); $this->assertInstanceOf('App\\Models\\Edition', $returnedEdition); $this->assertEquals($edition->content, $returnedEdition->content); $this->assertEquals($edition->id, $returnedEdition->id); }
/** * Tests the request of an article's editions * history the passed limit and the * expected page results. **/ public function testRouteGetEditionsHistoryHistoryPaginatedAndLimitedJsonReturned() { $limit = 40; $page = 3; $editions = Scenario::prepareEdition(null, null, 'content', $page * $limit); $response = $this->assertOk('GET', '/api/articles/' . $editions[0]->article_id . '/editions?limit=' . $limit . '&page=' . $page); $this->assertCount($limit, $response->editions); $this->assertEquals($page, $response->page); $this->assertEquals('content80', $response->editions[0]->content); }