From ef2ebd168c4c4ae76955672692cd40c3cd47f721 Mon Sep 17 00:00:00 2001 From: Rija Menage Date: Fri, 17 Jan 2020 16:33:36 +0800 Subject: [PATCH] Simplify JSON response from File Upload Wizard's upload endpoint because there's no reasons to wrap the list of upload files in a label/envelope, and because it's easier to mock in our fake api server we use for javascript tests without an envelope. --- fuw/app/frontend/controllers/UploadController.php | 4 ---- fuw/app/frontend/tests/functional/UploadCest.php | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/fuw/app/frontend/controllers/UploadController.php b/fuw/app/frontend/controllers/UploadController.php index 05f348d511..14b55f6a9c 100644 --- a/fuw/app/frontend/controllers/UploadController.php +++ b/fuw/app/frontend/controllers/UploadController.php @@ -16,10 +16,6 @@ class UploadController extends ActiveController { public $modelClass = 'common\models\Upload'; - public $serializer = [ - 'class' => 'yii\rest\Serializer', - 'collectionEnvelope' => 'uploads', - ]; /** * @inheritdoc diff --git a/fuw/app/frontend/tests/functional/UploadCest.php b/fuw/app/frontend/tests/functional/UploadCest.php index 79716ae2f9..5e37dd0a91 100644 --- a/fuw/app/frontend/tests/functional/UploadCest.php +++ b/fuw/app/frontend/tests/functional/UploadCest.php @@ -46,8 +46,8 @@ public function getUpload(FunctionalTester $I) $I->seeResponseIsJson(); $I->seeResponseContainsJson(array('doi' => "$doi")); $I->dontSeeResponseContainsJson(array('doi' => "010020")); - $I->seeResponseJsonMatchesJsonPath('$.uploads[0].name'); - $I->seeResponseJsonMatchesJsonPath('$.uploads[1].name'); - $I->dontSeeResponseJsonMatchesJsonPath('$.uploads[2].name'); + $I->seeResponseJsonMatchesJsonPath('$.[0].name'); + $I->seeResponseJsonMatchesJsonPath('$.[1].name'); + $I->dontSeeResponseJsonMatchesJsonPath('$.[2].name'); } }