/** * Tests the listing with * a provided pagination. **/ public function testRepositoryListArticlesProvidedPaginationCount() { Scenario::prepareArticle(null, 'testing pagination', 40); $articles = $this->repo->listArticles(null, null, 40); $this->assertCount(40, $articles); }
/** * Tries to get an inexistent edition. * * @expectedException Illuminate\Database\Eloquent\ModelNotFoundException **/ public function testRepositoryEditionAtIndexNotFoundException() { $article = Scenario::prepareArticle(); $this->repo->editionAtIndex($article->id, 1233213); }
/** * Search articles using title and asserting * for the passed page. **/ public function testRouteListArticlesWithTitlePageWithLimitJsonReturned() { $term = 'test search title'; $page = 3; $limit = 40; Scenario::prepareArticle(null, $term, $limit * $page); $response = $this->assertOk('GET', '/api/articles/search/' . $term . '?page=' . $page . '&limit=' . $limit); $this->assertCount($limit, $response->articles); $this->assertEquals($page, $response->page); $this->assertEquals($term . 80, $response->articles[0]->title); }
/** * Tests the request of an edition * expecting for a NotFound error. **/ public function testRouteListEditionByIDNotFound() { $article = Scenario::prepareArticle(); $this->assertNotFound('GET', '/api/articles/' . $article->id . '/editions/123321'); }