|
|
@@ -6,6 +6,7 @@ use PHPUnit\Framework\TestCase;
|
|
|
use n2n\test\TestEnv;
|
|
|
use internship\test\ArticleTestEnv;
|
|
|
use util\GeneralTestEnv;
|
|
|
+use n2n\web\http\StatusException;
|
|
|
|
|
|
|
|
|
class ArticleControllerTest extends TestCase {
|
|
|
@@ -28,12 +29,16 @@ class ArticleControllerTest extends TestCase {
|
|
|
$this->article3Id = $article3->getId();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @throws StatusException
|
|
|
+ */
|
|
|
function testGetDoArticles() {
|
|
|
$response = TestEnv::http()->newRequest()
|
|
|
->get(['api', 'articles'])
|
|
|
->exec();
|
|
|
|
|
|
$articleStructs = $response->parseJson();
|
|
|
+
|
|
|
$this->assertCount(3, $articleStructs);
|
|
|
|
|
|
$this->assertEquals('Title 3', $articleStructs[0]['title']);
|
|
|
@@ -41,4 +46,18 @@ class ArticleControllerTest extends TestCase {
|
|
|
$this->assertEquals('Title 1', $articleStructs[2]['title']);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @throws StatusException
|
|
|
+ */
|
|
|
+ function testGetDoArticlesByCategoryName() {
|
|
|
+ $response = TestEnv::http()->newRequest()
|
|
|
+ ->get(['api', 'articles', 'news'])
|
|
|
+ ->exec();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function testGetDoArticle() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|