diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be836c6..db213d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,4 +6,5 @@ include: ref: main file: - 'templates/groups/pkp_plugin.yml' - - 'templates/groups/ops_plugins_unit_tests_model.yml' + - 'templates/groups/ops_3_4_plugins_unit_tests_model.yml' + - 'templates/groups/ops_3_4_plugins_cypress_tests_model.yml' diff --git a/README.md b/README.md index 853a8eb..ec2e2c0 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ This plugin adds stages of moderation to OPS, giving moderators the possibility The latest release of this plugin is compatible with the following PKP applications: -* OPS 3.3.0 - +* OPS 3.4.0 ## Plugin Download @@ -24,6 +23,6 @@ To download the plugin, go to the [Releases page](https://github.com/lepidus/sci # License __This plugin is licensed under the GNU General Public License v3.0__ -__Copyright (c) 2022 Lepidus Tecnologia__ +__Copyright (c) 2022 - 2024 Lepidus Tecnologia__ -__Copyright (c) 2022 SciELO__ +__Copyright (c) 2022 - 2024 SciELO__ diff --git a/ScieloModerationStagesPlugin.inc.php b/ScieloModerationStagesPlugin.php similarity index 74% rename from ScieloModerationStagesPlugin.inc.php rename to ScieloModerationStagesPlugin.php index 9f8bd19..9006080 100644 --- a/ScieloModerationStagesPlugin.inc.php +++ b/ScieloModerationStagesPlugin.php @@ -3,8 +3,8 @@ /** * @file plugins/reports/scieloModerationStages/ScieloModerationStagesPlugin.inc.php * - * Copyright (c) 2022 Lepidus Tecnologia - * Copyright (c) 2022 SciELO + * Copyright (c) 2022 - 2024 Lepidus Tecnologia + * Copyright (c) 2022 - 2024 SciELO * Distributed under the GNU GPL v3. For full terms see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt. * * @class ScieloModerationStagesPlugin @@ -13,37 +13,48 @@ * @brief SciELO Moderation Stages Plugin */ -import('lib.pkp.classes.plugins.GenericPlugin'); -import('plugins.generic.scieloModerationStages.classes.ModerationStage'); -import('plugins.generic.scieloModerationStages.classes.ModerationStageRegister'); +namespace APP\plugins\generic\scieloModerationStages; -define('SCIELO_BRASIL_EMAIL', 'scielo.submission@scielo.org'); +use PKP\plugins\GenericPlugin; +use PKP\plugins\Hook; +use APP\core\Application; +use APP\template\TemplateManager; +use APP\facades\Repo; +use PKP\security\Role; +use PKP\db\DAORegistry; +use Illuminate\Support\Facades\Event; +use APP\plugins\generic\scieloModerationStages\classes\ModerationStage; +use APP\plugins\generic\scieloModerationStages\classes\ModerationStageRegister; +use APP\plugins\generic\scieloModerationStages\classes\observers\listeners\AssignFirstModerationStage; class ScieloModerationStagesPlugin extends GenericPlugin { + private const SCIELO_BRASIL_EMAIL = 'scielo.submission@scielo.org'; + public function register($category, $path, $mainContextId = null) { $success = parent::register($category, $path, $mainContextId); - if (!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE')) { - return true; + if (Application::isUnderMaintenance()) { + return $success; } if ($success && $this->getEnabled($mainContextId)) { - HookRegistry::register('Schema::get::submission', array($this, 'addOurFieldsToSubmissionSchema')); - HookRegistry::register('submissionsubmitstep4form::execute', array($this, 'setSubmissionFirstModerationStage')); - HookRegistry::register('addparticipantform::display', array($this, 'addFieldsAssignForm')); - HookRegistry::register('addparticipantform::execute', array($this, 'sendSubmissionToNextModerationStage')); - HookRegistry::register('queryform::display', array($this, 'hideParticipantsOnDiscussionOpening')); + Event::subscribe(new AssignFirstModerationStage()); + + Hook::add('Schema::get::submission', [$this, 'addOurFieldsToSubmissionSchema']); + Hook::add('addparticipantform::display', [$this, 'addStageAdvanceToAssignForm']); + Hook::add('addparticipantform::execute', [$this, 'sendSubmissionToNextModerationStage']); + Hook::add('queryform::display', [$this, 'hideParticipantsOnDiscussionOpening']); - HookRegistry::register('Template::Workflow::Publication', array($this, 'addToWorkflowTabs')); - HookRegistry::register('Template::Workflow', array($this, 'addCurrentStageStatus')); - HookRegistry::register('LoadComponentHandler', array($this, 'setupScieloModerationStagesHandler')); + Hook::add('Template::Workflow::Publication', [$this, 'addToWorkflowTabs']); + Hook::add('Template::Workflow', [$this, 'addCurrentStageStatusToWorkflow']); + Hook::add('LoadComponentHandler', [$this, 'setupScieloModerationStagesHandler']); + + Hook::add('TemplateManager::display', [$this, 'addJavaScriptAndStylesheet']); - HookRegistry::register('TemplateManager::display', array($this, 'addJavaScriptAndStylesheet')); $this->addHandlerURLToJavaScript(); } - return $success; } @@ -51,7 +62,7 @@ public function addHandlerURLToJavaScript() { $request = Application::get()->getRequest(); $templateMgr = TemplateManager::getManager($request); - $handlerUrl = $request->getDispatcher()->url($request, ROUTE_COMPONENT) . 'plugins/generic/scielo-moderation-stages/controllers/scielo-moderation-stages/'; + $handlerUrl = $request->getDispatcher()->url($request, Application::ROUTE_COMPONENT, null, 'plugins.generic.scieloModerationStages.controllers.ScieloModerationStagesHandler'); $data = ['moderationStagesHandlerUrl' => $handlerUrl]; $templateMgr->addJavaScript('ModerationStagesHandler', 'app = ' . json_encode($data) . ';', ['contexts' => 'backend', 'inline' => true]); @@ -124,18 +135,9 @@ public function addOurFieldsToSubmissionSchema($hookName, $params) return false; } - public function setSubmissionFirstModerationStage($hookName, $params) - { - $submission = $params[0]->submission; - $moderationStage = new ModerationStage($submission); - $moderationStage->setToFirstStage(); - $moderationStageRegister = new ModerationStageRegister(); - $moderationStageRegister->registerModerationStageOnSubmissionLog($moderationStage); - } - - public function addFieldsAssignForm($hookName, $params) + public function addStageAdvanceToAssignForm($hookName, $params) { - $request = PKPApplication::get()->getRequest(); + $request = Application::get()->getRequest(); $templateMgr = TemplateManager::getManager($request); $submission = $params[0]->getSubmission(); @@ -171,7 +173,7 @@ public function addToWorkflowTabs($hookName, $params) { $templateMgr = &$params[1]; $output = &$params[2]; - $submission = $templateMgr->get_template_vars('submission'); + $submission = $templateMgr->getTemplateVars('submission'); $moderationStage = new ModerationStage($submission); if ($moderationStage->submissionStageExists()) { @@ -198,22 +200,22 @@ public function addToWorkflowTabs($hookName, $params) } } - public function addCurrentStageStatus($hookName, $params) + public function addCurrentStageStatusToWorkflow($hookName, $params) { $templateMgr = &$params[1]; - $submission = $templateMgr->get_template_vars('submission'); + $submission = $templateMgr->getTemplateVars('submission'); if (!is_null($submission->getData('currentModerationStage'))) { $moderationStage = new ModerationStage($submission); $templateMgr->assign('currentStageName', $moderationStage->getCurrentStageName()); - $templateMgr->registerFilter("output", array($this, 'addCurrentStageStatusFilter')); + $templateMgr->registerFilter("output", [$this, 'addCurrentStageStatusToWorkflowFilter']); } return false; } - public function addCurrentStageStatusFilter($output, $templateMgr) + public function addCurrentStageStatusToWorkflowFilter($output, $templateMgr) { if (preg_match('/]+v-if="publicationList.length/', $output, $matches, PREG_OFFSET_CAPTURE)) { $posMatch = $matches[0][1]; @@ -221,7 +223,7 @@ public function addCurrentStageStatusFilter($output, $templateMgr) $currentStageStatus = $templateMgr->fetch($this->getTemplateResource('currentStageStatus.tpl')); $output = substr_replace($output, $currentStageStatus, $posMatch, 0); - $templateMgr->unregisterFilter('output', array($this, 'addCurrentStageStatusFilter')); + $templateMgr->unregisterFilter('output', array($this, 'addCurrentStageStatusToWorkflowFilter')); } return $output; } @@ -233,24 +235,24 @@ public function getStyleSheet() private function userIsAuthor($submission) { - $currentUser = \Application::get()->getRequest()->getUser(); + $currentUser = Application::get()->getRequest()->getUser(); $currentUserAssignedRoles = array(); if ($currentUser) { $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); $stageAssignmentsResult = $stageAssignmentDao->getBySubmissionAndUserIdAndStageId($submission->getId(), $currentUser->getId(), $submission->getData('stageId')); - $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); + while ($stageAssignment = $stageAssignmentsResult->next()) { - $userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId(), $submission->getData('contextId')); + $userGroup = Repo::userGroup()->get($stageAssignment->getUserGroupId(), $submission->getData('contextId')); $currentUserAssignedRoles[] = (int) $userGroup->getRoleId(); } } - return $currentUserAssignedRoles[0] == ROLE_ID_AUTHOR; + return $currentUserAssignedRoles[0] == Role::ROLE_ID_AUTHOR; } public function sendSubmissionToNextModerationStage($hookName, $params) { - $request = PKPApplication::get()->getRequest(); + $request = Application::get()->getRequest(); $form = $params[0]; $requestVars = $request->getUserVars(); @@ -275,19 +277,18 @@ public function hideParticipantsOnDiscussionOpening($hookName, $params) $allParticipants = $templateMgr->getTemplateVars('allParticipants'); $query = $form->getQuery(); - $submission = Services::get('submission')->get($query->getData('assocId')); + $submission = Repo::submission()->get($query->getData('assocId')); if ($this->userIsAuthor($submission)) { $author = $request->getUser(); $newParticipantsList = []; $allowedUsersEmails = [ $author->getEmail(), - SCIELO_BRASIL_EMAIL + self::SCIELO_BRASIL_EMAIL ]; foreach ($allParticipants as $participantId => $participantData) { - $userDao = DAORegistry::getDAO('UserDAO'); - $participant = $userDao->getById($participantId); + $participant = Repo::user()->get($participantId); if (in_array($participant->getEmail(), $allowedUsersEmails)) { $newParticipantsList[$participantId] = $participantData; diff --git a/classes/ModerationStage.inc.php b/classes/ModerationStage.php similarity index 68% rename from classes/ModerationStage.inc.php rename to classes/ModerationStage.php index 7e6df93..4853cae 100644 --- a/classes/ModerationStage.inc.php +++ b/classes/ModerationStage.php @@ -1,11 +1,16 @@ 'plugins.generic.scieloModerationStages.stages.formatStage', - SCIELO_MODERATION_STAGE_CONTENT => 'plugins.generic.scieloModerationStages.stages.contentStage', - SCIELO_MODERATION_STAGE_AREA => 'plugins.generic.scieloModerationStages.stages.areaStage', + self::SCIELO_MODERATION_STAGE_FORMAT => 'plugins.generic.scieloModerationStages.stages.formatStage', + self::SCIELO_MODERATION_STAGE_CONTENT => 'plugins.generic.scieloModerationStages.stages.contentStage', + self::SCIELO_MODERATION_STAGE_AREA => 'plugins.generic.scieloModerationStages.stages.areaStage', ]; return __($stageMap[$stage]); @@ -27,8 +32,8 @@ private function getModerationStageName($stage) private function getNextModerationStage($stage) { $nextStageMap = [ - SCIELO_MODERATION_STAGE_FORMAT => SCIELO_MODERATION_STAGE_CONTENT, - SCIELO_MODERATION_STAGE_CONTENT => SCIELO_MODERATION_STAGE_AREA, + self::SCIELO_MODERATION_STAGE_FORMAT => self::SCIELO_MODERATION_STAGE_CONTENT, + self::SCIELO_MODERATION_STAGE_CONTENT => self::SCIELO_MODERATION_STAGE_AREA, ]; return $nextStageMap[$stage]; @@ -37,9 +42,9 @@ private function getNextModerationStage($stage) private function getModerationStageEntryConfig($stage) { $stageMap = [ - SCIELO_MODERATION_STAGE_FORMAT => 'formatStageEntryDate', - SCIELO_MODERATION_STAGE_CONTENT => 'contentStageEntryDate', - SCIELO_MODERATION_STAGE_AREA => 'areaStageEntryDate', + self::SCIELO_MODERATION_STAGE_FORMAT => 'formatStageEntryDate', + self::SCIELO_MODERATION_STAGE_CONTENT => 'contentStageEntryDate', + self::SCIELO_MODERATION_STAGE_AREA => 'areaStageEntryDate', ]; return $stageMap[$stage]; @@ -81,12 +86,12 @@ public function getNextStageName(): string public function canAdvanceStage(): bool { - if ($this->submission->getData('status') == STATUS_DECLINED || $this->submission->getData('status') == STATUS_PUBLISHED) { + if ($this->submission->getData('status') == Submission::STATUS_DECLINED || $this->submission->getData('status') == Submission::STATUS_PUBLISHED) { return false; } $currentStage = $this->submission->getData('currentModerationStage'); - if (is_null($currentStage) || $currentStage == SCIELO_MODERATION_STAGE_AREA) { + if (is_null($currentStage) || $currentStage == self::SCIELO_MODERATION_STAGE_AREA) { return false; } @@ -100,7 +105,7 @@ public function submissionStageExists(): bool public function setToFirstStage() { - $this->setSubmissionToStage(SCIELO_MODERATION_STAGE_FORMAT); + $this->setSubmissionToStage(self::SCIELO_MODERATION_STAGE_FORMAT); } public function sendNextStage() diff --git a/classes/ModerationStageDAO.inc.php b/classes/ModerationStageDAO.php similarity index 78% rename from classes/ModerationStageDAO.inc.php rename to classes/ModerationStageDAO.php index 0b58f12..a846de2 100644 --- a/classes/ModerationStageDAO.inc.php +++ b/classes/ModerationStageDAO.php @@ -9,16 +9,16 @@ * Operations for retrieving data to help identify submissions' moderation stage */ -import('lib.pkp.classes.db.DAO'); +namespace APP\plugins\generic\scieloModerationStages\classes; -use Illuminate\Database\Capsule\Manager as Capsule; -use Illuminate\Support\Collection; +use PKP\db\DAO; +use Illuminate\Support\Facades\DB; class ModerationStageDAO extends DAO { public function getSubmissionModerationStage($submissionId): ?int { - $result = Capsule::table('submission_settings') + $result = DB::table('submission_settings') ->where('submission_id', $submissionId) ->where('setting_name', 'currentModerationStage') ->select('setting_value') diff --git a/classes/ModerationStageRegister.inc.php b/classes/ModerationStageRegister.inc.php deleted file mode 100644 index 6f161e8..0000000 --- a/classes/ModerationStageRegister.inc.php +++ /dev/null @@ -1,21 +0,0 @@ -updateObject($moderationStage->submission); - } - - public function registerModerationStageOnSubmissionlog($moderationStage) - { - $moderationStageName = $moderationStage->getCurrentStageName(); - $request = Application::get()->getRequest(); - SubmissionLog::logEvent($request, $moderationStage->submission, SUBMISSION_LOG_METADATA_UPDATE, 'plugins.generic.scieloModerationStages.log.submissionSentToModerationStage', ['moderationStageName' => $moderationStageName]); - } -} diff --git a/classes/ModerationStageRegister.php b/classes/ModerationStageRegister.php new file mode 100644 index 0000000..77e56f1 --- /dev/null +++ b/classes/ModerationStageRegister.php @@ -0,0 +1,37 @@ +edit($stage->submission, []); + } + + public function registerModerationStageOnSubmissionlog(ModerationStage $stage) + { + $stageName = $stage->getCurrentStageName(); + $submission = $stage->submission; + + $user = Application::get()->getRequest()->getUser(); + + $eventLog = Repo::eventLog()->newDataObject([ + 'assocType' => Application::ASSOC_TYPE_SUBMISSION, + 'assocId' => $submission->getId(), + 'eventType' => PKPSubmissionEventLogEntry::SUBMISSION_LOG_METADATA_UPDATE, + 'userId' => Validation::loggedInAs() ?? $user->getId(), + 'message' => __('plugins.generic.scieloModerationStages.log.submissionSentToModerationStage', ['moderationStageName' => $stageName]), + 'isTranslated' => true, + 'dateLogged' => Core::getCurrentDate(), + ]); + Repo::eventLog()->add($eventLog); + } +} diff --git a/classes/observers/listeners/AssignFirstModerationStage.php b/classes/observers/listeners/AssignFirstModerationStage.php new file mode 100644 index 0000000..a1b5b86 --- /dev/null +++ b/classes/observers/listeners/AssignFirstModerationStage.php @@ -0,0 +1,29 @@ +listen( + SubmissionSubmitted::class, + AssignFirstModerationStage::class + ); + } + + public function handle(SubmissionSubmitted $event): void + { + $submission = $event->submission; + $moderationStage = new ModerationStage($submission); + $moderationStage->setToFirstStage(); + $moderationStageRegister = new ModerationStageRegister(); + $moderationStageRegister->registerModerationStageOnDatabase($moderationStage); + $moderationStageRegister->registerModerationStageOnSubmissionLog($moderationStage); + } +} diff --git a/controllers/ScieloModerationStagesHandler.inc.php b/controllers/ScieloModerationStagesHandler.php similarity index 79% rename from controllers/ScieloModerationStagesHandler.inc.php rename to controllers/ScieloModerationStagesHandler.php index 6a27a4f..e3b80e4 100644 --- a/controllers/ScieloModerationStagesHandler.inc.php +++ b/controllers/ScieloModerationStagesHandler.php @@ -1,10 +1,16 @@ getById($args['submissionId']); + $submission = Repo::submission()->get($args['submissionId']); $moderationStage = new ModerationStage($submission); if (isset($args['formatStageEntryDate'])) { @@ -37,7 +42,7 @@ public function updateSubmissionStageData($args, $request) $moderationStageRegister->registerModerationStageOnSubmissionLog($moderationStage); } - $submissionDao->updateObject($submission); + Repo::submission()->edit($submission, []); return http_response_code(200); } @@ -62,8 +67,8 @@ public function getSubmissionExhibitData($args, $request) public function getUserIsAuthor($args, $request) { - $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES); - $adminRoles = [ROLE_ID_SITE_ADMIN, ROLE_ID_SUB_EDITOR]; + $userRoles = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES); + $adminRoles = [Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR]; if (count(array_intersect($userRoles, $adminRoles)) > 0) { return json_encode(0); @@ -79,9 +84,9 @@ private function getSubmissionModerationStage($submissionId) $moderationStage = $moderationStageDAO->getSubmissionModerationStage($submissionId); if (!is_null($moderationStage)) { $stageMap = [ - SCIELO_MODERATION_STAGE_FORMAT => 'plugins.generic.scieloModerationStages.stages.formatStage', - SCIELO_MODERATION_STAGE_CONTENT => 'plugins.generic.scieloModerationStages.stages.contentStage', - SCIELO_MODERATION_STAGE_AREA => 'plugins.generic.scieloModerationStages.stages.areaStage', + ModerationStage::SCIELO_MODERATION_STAGE_FORMAT => 'plugins.generic.scieloModerationStages.stages.formatStage', + ModerationStage::SCIELO_MODERATION_STAGE_CONTENT => 'plugins.generic.scieloModerationStages.stages.contentStage', + ModerationStage::SCIELO_MODERATION_STAGE_AREA => 'plugins.generic.scieloModerationStages.stages.areaStage', ]; $moderationStageText = __('plugins.generic.scieloModerationStages.currentStageStatusLabel') . ' ' . __($stageMap[$moderationStage]); @@ -128,18 +133,15 @@ private function getAreaModerators($submissionId) private function getAssignedUsers($submissionId, $abbrev): array { $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); - $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); - $userDao = DAORegistry::getDAO('UserDAO'); - - $stageAssignmentsResults = $stageAssignmentDao->getBySubmissionAndRoleId($submissionId, ROLE_ID_SUB_EDITOR, self::SUBMISSION_STAGE_ID); + $stageAssignmentsResults = $stageAssignmentDao->getBySubmissionAndRoleId($submissionId, Role::ROLE_ID_SUB_EDITOR, self::SUBMISSION_STAGE_ID); $assignedUsers = []; while ($stageAssignment = $stageAssignmentsResults->next()) { - $userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId()); - $userGroupAbbrev = strtolower($userGroup->getData('abbrev', 'en_US')); + $userGroup = Repo::userGroup()->get($stageAssignment->getUserGroupId()); + $userGroupAbbrev = strtolower($userGroup->getData('abbrev', 'en')); if ($userGroupAbbrev == $abbrev) { - $user = $userDao->getById($stageAssignment->getUserId(), false); + $user = Repo::user()->get($stageAssignment->getUserId(), false); $assignedUsers[$user->getData('username')] = $user->getFullName(); } } @@ -149,15 +151,15 @@ private function getAssignedUsers($submissionId, $abbrev): array private function getSecondDateParamsForTimeExhibitors($submission): array { - if ($submission->getData('status') == STATUS_PUBLISHED) { + if ($submission->getData('status') == Submission::STATUS_PUBLISHED) { $publication = $submission->getCurrentPublication(); return ['datePublished', $publication->getData('datePublished')]; } - if ($submission->getData('status') == STATUS_DECLINED) { - $result = Capsule::table('edit_decisions') + if ($submission->getData('status') == Submission::STATUS_DECLINED) { + $result = DB::table('edit_decisions') ->where('submission_id', $submission->getId()) - ->whereIn('decision', [SUBMISSION_EDITOR_DECISION_DECLINE, SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE]) + ->whereIn('decision', [Decision::DECLINE, Decision::INITIAL_DECLINE]) ->orderBy('date_decided', 'asc') ->first(); @@ -189,7 +191,7 @@ private function getDataForTimeExhibitors($submission, $firstDate, $exhibitor): private function getTimeSubmitted($submissionId) { - $submission = DAORegistry::getDAO('SubmissionDAO')->getById($submissionId); + $submission = Repo::submission()->get($submissionId); $dateSubmitted = $submission->getData('dateSubmitted'); if (empty($dateSubmitted)) { @@ -202,15 +204,13 @@ private function getTimeSubmitted($submissionId) private function getLastAssignmentDate($submissionId, $abbrev): string { $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); - $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); - $userDao = DAORegistry::getDAO('UserDAO'); - $stageAssignmentsResults = $stageAssignmentDao->getBySubmissionAndRoleId($submissionId, ROLE_ID_SUB_EDITOR, self::SUBMISSION_STAGE_ID); + $stageAssignmentsResults = $stageAssignmentDao->getBySubmissionAndRoleId($submissionId, Role::ROLE_ID_SUB_EDITOR, self::SUBMISSION_STAGE_ID); $lastAssignmentDate = ""; while ($stageAssignment = $stageAssignmentsResults->next()) { - $userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId()); - $currentUserGroupAbbrev = strtolower($userGroup->getData('abbrev', 'en_US')); + $userGroup = Repo::userGroup()->get($stageAssignment->getUserGroupId()); + $currentUserGroupAbbrev = strtolower($userGroup->getData('abbrev', 'en')); if ($currentUserGroupAbbrev == $abbrev) { if (empty($lastAssignmentDate) or ($stageAssignment->getData('dateAssigned') > $lastAssignmentDate)) { @@ -224,7 +224,7 @@ private function getLastAssignmentDate($submissionId, $abbrev): string private function getTimeResponsible($submissionId) { - $submission = DAORegistry::getDAO('SubmissionDAO')->getById($submissionId); + $submission = Repo::submission()->get($submissionId); $lastAssignmentDate = $this->getLastAssignmentDate($submissionId, 'resp'); if (empty($lastAssignmentDate)) { @@ -235,7 +235,7 @@ private function getTimeResponsible($submissionId) private function getTimeAreaModerator($submissionId) { - $submission = DAORegistry::getDAO('SubmissionDAO')->getById($submissionId); + $submission = Repo::submission()->get($submissionId); $lastAssignmentDate = $this->getLastAssignmentDate($submissionId, 'am'); if (empty($lastAssignmentDate)) { diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 0000000..ee3c0ea --- /dev/null +++ b/cypress/support/commands.js @@ -0,0 +1,65 @@ +function beginSubmission(submissionData) { + cy.get('input[name="locale"][value="en"]').click(); + cy.setTinyMceContent('startSubmission-title-control', submissionData.title); + cy.get('input[name="submissionRequirements"]').check(); + cy.get('input[name="privacyConsent"]').check(); + + cy.contains('button', 'Begin Submission').click(); +} + +function detailsStep(submissionData) { + cy.setTinyMceContent('titleAbstract-abstract-control-en', submissionData.abstract); + submissionData.keywords.forEach(keyword => { + cy.get('#titleAbstract-keywords-control-en').type(keyword, {delay: 0}); + cy.get('#titleAbstract-keywords-control-en').type('{enter}', {delay: 0}); + }); + + cy.contains('button', 'Continue').click(); +} + +function filesStep(submissionData) { + cy.addSubmissionGalleys(submissionData.files); + cy.contains('button', 'Continue').click(); +} + +function contributorsStep(submissionData) { + submissionData.contributors.forEach(authorData => { + cy.contains('button', 'Add Contributor').click(); + cy.get('input[name="givenName-en"]').type(authorData.given, {delay: 0}); + cy.get('input[name="familyName-en"]').type(authorData.family, {delay: 0}); + cy.get('input[name="email"]').type(authorData.email, {delay: 0}); + cy.get('select[name="country"]').select(authorData.country); + + cy.get('.modal__panel:contains("Add Contributor")').find('button').contains('Save').click(); + cy.waitJQuery(); + }); + + cy.contains('button', 'Continue').click(); +} + +Cypress.Commands.add('createSubmission', function (submissionData) { + cy.get('div#myQueue a:contains("New Submission")').click(); + + beginSubmission(submissionData); + detailsStep(submissionData); + filesStep(submissionData); + contributorsStep(submissionData); + cy.get('input[name="relationStatus"][value="1"]').check(); + cy.contains('button', 'Continue').click(); + cy.contains('button', 'Submit').click(); + cy.get('.modal__panel:visible').within(() => { + cy.contains('button', 'Submit').click(); + }); + + cy.waitJQuery(); + cy.contains('h1', 'Submission complete'); +}); + +Cypress.Commands.add('findSubmission', function(tab, title) { + cy.wait(3000); + cy.get('#' + tab + '-button').click(); + cy.get('.listPanel__itemSubtitle:visible:contains("' + title + '")').first() + .parent().parent().within(() => { + cy.get('.pkpButton:contains("View")').click(); + }); +}); \ No newline at end of file diff --git a/cypress/tests/Test0_pluginSetup.cy.js b/cypress/tests/Test0_pluginSetup.cy.js new file mode 100644 index 0000000..320de16 --- /dev/null +++ b/cypress/tests/Test0_pluginSetup.cy.js @@ -0,0 +1,13 @@ +describe('SciELO Moderation Stages - Plugin setup', function () { + it('Enables SciELO Moderation Stages plugin', function () { + cy.login('dbarnes', null, 'publicknowledge'); + + cy.contains('a', 'Website').click(); + + cy.waitJQuery(); + cy.get('#plugins-button').click(); + + cy.get('input[id^=select-cell-scielomoderationstagesplugin]').check(); + cy.get('input[id^=select-cell-scielomoderationstagesplugin]').should('be.checked'); + }); +}); \ No newline at end of file diff --git a/cypress/tests/Test1_moderationStageAdvancement.cy.js b/cypress/tests/Test1_moderationStageAdvancement.cy.js new file mode 100644 index 0000000..6e06060 --- /dev/null +++ b/cypress/tests/Test1_moderationStageAdvancement.cy.js @@ -0,0 +1,85 @@ +import '../support/commands.js'; + +function checkSendNextStageOptionIsPresent() { + cy.contains("This submission is in the Format Pre-Moderation stage, do you want to send it to the Manuscript Type Pre-Moderation stage? "); + cy.get('#checkboxSendNextStageAssignYes').parent().contains("Yes"); + cy.get('#checkboxSendNextStageAssignNo').parent().contains("No"); + cy.get('#checkboxSendNextStageAssignYes').should('not.be.checked'); + cy.get('#checkboxSendNextStageAssignNo').should('not.be.checked'); +} + +describe("SciELO Moderation Stages - Moderation stage advancement", function() { + let submissionData; + + before(function() { + Cypress.config('defaultCommandTimeout', 4000); + submissionData = { + title: "Night of the Living Dead", + abstract: 'Some people get stuck in a house when the dead arise from their graves', + keywords: ['plugin', 'testing'], + contributors: [ + { + 'given': 'George', + 'family': 'Romero', + 'email': 'george.romero@stab.com', + 'country': 'United States' + } + ], + files: [ + { + 'file': 'dummy.pdf', + 'fileName': 'dummy.pdf', + 'mimeType': 'application/pdf', + 'genre': 'Preprint Text' + } + ] + }; + }); + + it("Author creates submission", function() { + cy.login('fpaglieri', null, 'publicknowledge'); + cy.createSubmission(submissionData); + }); + it("Checks submission is set to first moderation stage", function() { + cy.login('fpaglieri', null, 'publicknowledge'); + cy.findSubmission('myQueue', submissionData.title); + + cy.contains('strong', 'Moderation stage:'); + cy.contains('span', 'Format Pre-Moderation'); + }); + it("Checks sending of submission to next moderation stage", function() { + cy.login('dbarnes', null, 'publicknowledge'); + cy.findSubmission('active', submissionData.title); + + cy.contains('strong', 'Moderation stage:'); + cy.contains('span', 'Format Pre-Moderation'); + + cy.contains('a', 'Assign').click(); + checkSendNextStageOptionIsPresent(); + cy.get('tr[id^="component-grid-users-userselect-userselectgrid-row"] > .first_column > input').first().click(); + cy.get('#checkboxSendNextStageAssignYes').click(); + cy.get("#addParticipantForm > .formButtons > .submitFormButton").click(); + cy.wait(3000); + cy.reload(); + + cy.contains('span', 'Manuscript Type Pre-Moderation'); + cy.contains('button', 'Activity Log').click(); + cy.contains('The submission has been sent to the Manuscript Type Pre-Moderation stage'); + }); + it("Checks stage advancing not present in last stage", function() { + cy.login('dbarnes', null, 'publicknowledge'); + cy.findSubmission('active', submissionData.title); + + cy.contains('a', 'Assign').click(); + cy.get('tr[id^="component-grid-users-userselect-userselectgrid-row"] > .first_column > input').first().click(); + cy.get('#checkboxSendNextStageAssignYes').click(); + cy.get("#addParticipantForm > .formButtons > .submitFormButton").click(); + cy.wait(3000); + cy.reload(); + + cy.contains('span', 'Area Moderation'); + cy.contains('a', 'Assign').click(); + cy.get('#checkboxSendNextStageAssignYes').should('not.exist'); + cy.get('#checkboxSendNextStageAssignNo').should('not.exist'); + }); +}); diff --git a/cypress/tests/Test1_submissionFirstModerationStage.spec.js b/cypress/tests/Test1_submissionFirstModerationStage.spec.js deleted file mode 100644 index 7209500..0000000 --- a/cypress/tests/Test1_submissionFirstModerationStage.spec.js +++ /dev/null @@ -1,74 +0,0 @@ -function loginAuthorUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAuthorUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAuthorPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function loginAdminUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAdminUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAdminPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function userLogout() { - cy.get(".pkpDropdown.app__headerAction > .pkpButton").click(); - cy.get("a.pkpDropdown__action").contains("Logout").click(); -} - -function submissionStep1() { - cy.get('#sectionId').select('1'); - cy.get('#pkp_submissionChecklist > ul > li > label > input').check(); - cy.get('#privacyConsent').check(); - - cy.get('#submissionStep1 > .formButtons > .submitFormButton').click(); -} - -function submissionStep2() { - cy.get('#submitStep2Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep3() { - cy.get('input[name^="title"]').first().type("Submission test first moderation stage", { delay: 0 }); - cy.get('label').contains('Title').click(); - cy.get('textarea[id^="abstract-"').then((node) => { - cy.setTinyMceContent(node.attr("id"), "Example of abstract"); - }); - cy.get('.section > label:visible').first().click(); - cy.get('ul[id^="en_US-keywords-"]').then(node => { - node.tagit('createTag', "Dummy keyword"); - }); - cy.get('#submitStep3Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep4() { - cy.get('#submitStep4Form > .formButtons > .submitFormButton').click(); - cy.get('.pkp_modal_confirmation > .footer > .ok').click(); -} - -function checkSubmissionAssignedToFirstModerationStage() { - cy.get('.pkpButton').contains('Activity Log').click(); - cy.get('.gridCellContainer > span').should('contain', 'The submission has been sent to the Format Pre-Moderation stage'); -} - -describe("SciELO Moderation Stages Plugin - Submission is put in first moderation stage", function() { - it("Author user submits", function() { - cy.visit(Cypress.env('baseUrl') + 'index.php/scielo/submissions'); - loginAuthorUser(); - - cy.get('.pkpHeader__actions:visible > a.pkpButton').click(); - submissionStep1(); - submissionStep2(); - submissionStep3(); - submissionStep4(); - userLogout(); - }); - it("Check if plugin registered the assignment to first moderation stage in submission's activity log", function() { - loginAdminUser(); - cy.wait(3000); - cy.get("#active-button").click(); - cy.get(".listPanel__itemActions:visible > a.pkpButton").first().click(); - checkSubmissionAssignedToFirstModerationStage(); - }); -}); diff --git a/cypress/tests/Test2_sentToStageOnUserAssignModal.spec.js b/cypress/tests/Test2_sentToStageOnUserAssignModal.spec.js deleted file mode 100644 index f3e9b00..0000000 --- a/cypress/tests/Test2_sentToStageOnUserAssignModal.spec.js +++ /dev/null @@ -1,88 +0,0 @@ -function loginAuthorUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAuthorUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAuthorPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function loginAdminUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAdminUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAdminPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function userLogout() { - cy.get(".pkpDropdown.app__headerAction > .pkpButton").click(); - cy.get("a.pkpDropdown__action").contains("Logout").click(); -} - -function submissionStep1() { - cy.get('#sectionId').select('1'); - cy.get('#pkp_submissionChecklist > ul > li > label > input').check(); - cy.get('#privacyConsent').check(); - - cy.get('#submissionStep1 > .formButtons > .submitFormButton').click(); -} - -function submissionStep2() { - cy.get('#submitStep2Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep3() { - cy.get('input[name^="title"]').first().type("Submission test first moderation stage", { delay: 0 }); - cy.get('label').contains('Title').click(); - cy.get('textarea[id^="abstract-"').then((node) => { - cy.setTinyMceContent(node.attr("id"), "Example of abstract"); - }); - cy.get('.section > label:visible').first().click(); - cy.get('ul[id^="en_US-keywords-"]').then(node => { - node.tagit('createTag', "Dummy keyword"); - }); - cy.get('#submitStep3Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep4() { - cy.get('#submitStep4Form > .formButtons > .submitFormButton').click(); - cy.get('.pkp_modal_confirmation > .footer > .ok').click(); -} - -function checkOptionSendNextStageIsPresent() { - cy.contains("This submission is in the Format Pre-Moderation stage, do you want to send it to the Content Pre-Moderation stage?"); - cy.get('#checkboxSendNextStageAssignYes').parent().contains("Yes"); - cy.get('#checkboxSendNextStageAssignNo').parent().contains("No"); - cy.get('#checkboxSendNextStageAssignYes').should('not.be.checked'); - cy.get('#checkboxSendNextStageAssignNo').should('not.be.checked'); -} - -function checkSubmissionHasBeenSentToNextModerationStage() { - cy.get('.pkpButton').contains('Activity Log').click(); - cy.get('.gridCellContainer > span').should('contain', 'The submission has been sent to the Content Pre-Moderation stage'); -} - -describe("SciELO Moderation Stages Plugin - Option to sent submission to next moderation stage", function() { - it("Author user submits", function() { - cy.visit(Cypress.env('baseUrl') + 'index.php/scielo/submissions'); - loginAuthorUser(); - - cy.get('.pkpHeader__actions:visible > a.pkpButton').click(); - submissionStep1(); - submissionStep2(); - submissionStep3(); - submissionStep4(); - userLogout(); - }); - it("Check option to sent submission to next moderation stage in user assign modal", function() { - loginAdminUser(); - cy.wait(3000); - cy.get("#active-button").click(); - cy.get(".listPanel__itemActions:visible > a.pkpButton").first().click(); - cy.get("a").contains("Assign").click(); - checkOptionSendNextStageIsPresent(); - cy.get('tr[id^="component-grid-users-userselect-userselectgrid-row"] > .first_column > input').first().click(); - cy.get('#checkboxSendNextStageAssignYes').click(); - cy.get("#addParticipantForm > .formButtons > .submitFormButton").click(); - cy.wait(3000); - checkSubmissionHasBeenSentToNextModerationStage(); - }); -}); diff --git a/cypress/tests/Test2_stageAdvancementHidden.cy.js b/cypress/tests/Test2_stageAdvancementHidden.cy.js new file mode 100644 index 0000000..01d6e3b --- /dev/null +++ b/cypress/tests/Test2_stageAdvancementHidden.cy.js @@ -0,0 +1,75 @@ +import '../support/commands.js'; + +function checkSendNextStageOptionIsNotPresent() { + cy.contains("This submission is in the Format Pre-Moderation stage").should('not.exist'); + cy.get('#checkboxSendNextStageAssignYes').should('not.exist'); + cy.get('#checkboxSendNextStageAssignNo').should('not.exist'); +} + +describe("SciELO Moderation Stages - Stage advancement hidden scenarios", function() { + let submissionData; + + before(function() { + Cypress.config('defaultCommandTimeout', 4000); + submissionData = { + title: "Candyman", + abstract: 'A ghost appears when you speak his name 5 times in front of a mirror', + keywords: ['plugin', 'testing'], + contributors: [ + { + 'given': 'Clive', + 'family': 'Barker', + 'email': 'clive.barker@stab.com', + 'country': 'United Kingdom' + } + ], + files: [ + { + 'file': 'dummy.pdf', + 'fileName': 'dummy.pdf', + 'mimeType': 'application/pdf', + 'genre': 'Preprint Text' + } + ] + }; + }); + + it("Author creates submission", function() { + cy.login('fpaglieri', null, 'publicknowledge'); + cy.createSubmission(submissionData); + }); + it("Sending of submission to next moderation stage does not appear when posted/declined", function() { + cy.login('dbarnes', null, 'publicknowledge'); + cy.findSubmission('active', submissionData.title); + + cy.get('#publication-button').click(); + cy.get('.pkpHeader__actions button:contains("Post")').click(); + cy.get('.pkp_modal_panel button:contains("Post")').click(); + cy.waitJQuery(); + cy.contains('span', 'Posted'); + cy.reload(); + + cy.get('#workflow-button').click(); + cy.contains('a', 'Assign').click(); + checkSendNextStageOptionIsNotPresent(); + cy.get('a.pkpModalCloseButton:visible').click(); + cy.on('window:confirm', () => true); + cy.wait(3000); + + cy.get('#publication-button').click(); + cy.get('.pkpHeader__actions button:contains("Unpost")').click(); + cy.get('.modal__panel button:contains("Unpost")').click(); + cy.waitJQuery(); + cy.contains('span', 'Unposted'); + cy.reload(); + + cy.get('#workflow-button').click(); + cy.contains('a', 'Decline Submission').click(); + cy.contains('button', 'Skip this email').click(); + cy.contains('button', 'Record Decision').click(); + cy.contains('a', 'View Submission').click(); + + cy.contains('a', 'Assign').click(); + checkSendNextStageOptionIsNotPresent(); + }); +}); diff --git a/cypress/tests/Test3_submissionIsRejected.spec.js b/cypress/tests/Test3_submissionIsRejected.spec.js deleted file mode 100644 index 9d11735..0000000 --- a/cypress/tests/Test3_submissionIsRejected.spec.js +++ /dev/null @@ -1,86 +0,0 @@ -function loginAuthorUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAuthorUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAuthorPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function loginAdminUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAdminUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAdminPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function userLogout() { - cy.get(".pkpDropdown.app__headerAction > .pkpButton").click(); - cy.get("a.pkpDropdown__action").contains("Logout").click(); -} - -function submissionStep1() { - cy.get('#sectionId').select('1'); - cy.get('#pkp_submissionChecklist > ul > li > label > input').check(); - cy.get('#privacyConsent').check(); - - cy.get('#submissionStep1 > .formButtons > .submitFormButton').click(); -} - -function submissionStep2() { - cy.get('#submitStep2Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep3() { - cy.get('input[name^="title"]').first().type("Submission test first moderation stage", { delay: 0 }); - cy.get('label').contains('Title').click(); - cy.get('textarea[id^="abstract-"').then((node) => { - cy.setTinyMceContent(node.attr("id"), "Example of abstract"); - }); - cy.get('.section > label:visible').first().click(); - cy.get('ul[id^="en_US-keywords-"]').then(node => { - node.tagit('createTag', "Dummy keyword"); - }); - cy.get('#submitStep3Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep4() { - cy.get('#submitStep4Form > .formButtons > .submitFormButton').click(); - cy.get('.pkp_modal_confirmation > .footer > .ok').click(); -} - -function rejectSubmission() { - cy.get("#editorialActions > li > a").contains("Decline").click(); - cy.get("#sendReviews > .formButtons > .submitFormButton").click(); -} - -function checkOptionSendNextStageIsNotPresent() { - cy.get("a").contains("Assign").click(); - cy.get('#checkboxSendNextStageDiv').should('not.exist'); -} - -describe("SciELO Moderation Stages Plugin - Option to sent submission to next moderation stage when submission is rejected", function() { - it("Author user submits", function() { - cy.visit(Cypress.env('baseUrl') + 'index.php/scielo/submissions'); - loginAuthorUser(); - - cy.get('.pkpHeader__actions:visible > a.pkpButton').click(); - submissionStep1(); - submissionStep2(); - submissionStep3(); - submissionStep4(); - userLogout(); - }); - it("Check option to sent submission to next moderation stage does not show when submision is rejected", function() { - loginAdminUser(); - cy.wait(3000); - cy.get("#active-button").click(); - cy.get(".listPanel__itemActions:visible > a.pkpButton").first().click(); - - rejectSubmission(); - - cy.visit(Cypress.env('baseUrl') + 'index.php/scielo/submissions'); - cy.wait(3000); - cy.get("#archive-button").click(); - cy.get(".listPanel__itemActions:visible > a.pkpButton").first().click(); - checkOptionSendNextStageIsNotPresent(); - }); -}); \ No newline at end of file diff --git a/cypress/tests/Test3_workflowTab.cy.js b/cypress/tests/Test3_workflowTab.cy.js new file mode 100644 index 0000000..cc58fe9 --- /dev/null +++ b/cypress/tests/Test3_workflowTab.cy.js @@ -0,0 +1,89 @@ +import '../support/commands.js'; + +describe("SciELO Moderation Stages - Workflow tab", function() { + let submissionData; + let today; + let yesterday; + + before(function() { + Cypress.config('defaultCommandTimeout', 4000); + today = (new Date()).toISOString().split('T')[0]; + yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + yesterday = yesterday.toISOString().split('T')[0]; + + submissionData = { + title: "Ju-on: The Grudge", + abstract: 'A house were terrible things happened', + keywords: ['plugin', 'testing'], + contributors: [ + { + 'given': 'Takashi', + 'family': 'Shimizu', + 'email': 'takashi.shimizu@stab.com', + 'country': 'Japan' + } + ], + files: [ + { + 'file': 'dummy.pdf', + 'fileName': 'dummy.pdf', + 'mimeType': 'application/pdf', + 'genre': 'Preprint Text' + } + ] + }; + }); + + it("Author creates submission", function() { + cy.login('fpaglieri', null, 'publicknowledge'); + cy.createSubmission(submissionData); + }); + it("Author views entry date for each moderation stage", function() { + cy.login('fpaglieri', null, 'publicknowledge'); + cy.findSubmission('myQueue', submissionData.title); + + cy.get('#scieloModerationStages-button').click(); + cy.get('#formatStageEntryDateDiv').within(() => { + cy.contains('label', 'Format Pre-Moderation'); + cy.contains('label', 'The submission has entered in this moderation stage in the following data'); + cy.get('input[name="formatStageEntryDate"]').should('have.value', today); + cy.get('input[name="formatStageEntryDate"]').should('be.disabled'); + }); + cy.get('#moderationStageSubmit').should('not.exist'); + }); + it("Editor edits submission's entry dates", function() { + cy.login('dbarnes', null, 'publicknowledge'); + cy.findSubmission('active', submissionData.title); + + cy.get('#publication-button').click(); + cy.get('#scieloModerationStages-button').click(); + + cy.get('#formatStageEntryDateDiv').within(() => { + cy.get('input[name="formatStageEntryDate"]').should('have.value', today); + cy.get('input[name="formatStageEntryDate"]').type(yesterday); + }); + cy.get('#moderationStageSubmit').click(); + + cy.reload(); + cy.get('#formatStageEntryDateDiv').within(() => { + cy.get('input[name="formatStageEntryDate"]').should('have.value', yesterday); + }); + }); + it("Editor advances moderation stage in workflow tab", function() { + cy.login('dbarnes', null, 'publicknowledge'); + cy.findSubmission('active', submissionData.title); + + cy.get('#publication-button').click(); + cy.get('#scieloModerationStages-button').click(); + + cy.get('#checkboxSendNextStageMenuYes').check(); + cy.get('#moderationStageSubmit').click(); + + cy.reload(); + cy.get('#formatStageEntryDateDiv'); + cy.get('#contentStageEntryDateDiv').within(() => { + cy.get('input[name="contentStageEntryDate"]').should('have.value', today); + }); + }); +}); diff --git a/cypress/tests/Test4_exhibitorsSubmissionsPage.cy.js b/cypress/tests/Test4_exhibitorsSubmissionsPage.cy.js new file mode 100644 index 0000000..ca40ac0 --- /dev/null +++ b/cypress/tests/Test4_exhibitorsSubmissionsPage.cy.js @@ -0,0 +1,48 @@ +import '../support/commands.js'; + +describe('SciELO Moderation Stages - Exhibitors on submissions page', function () { + let submission1 = "Night of the Living Dead"; + let submission2 = "Ju-on: The Grudge"; + + before(function() { + Cypress.config('defaultCommandTimeout', 4000); + }); + + it("Authors can only view submissions' moderation stage", function () { + cy.login('fpaglieri', null, 'publicknowledge'); + + cy.waitJQuery(); + cy.get('.listPanel__itemSubtitle:visible:contains("' + submission1 + '")') + .parent().within(() => { + cy.contains('Moderation stage:'); + cy.contains('Area Moderation'); + }); + + cy.get('.listPanel__itemSubtitle:visible:contains("' + submission2 + '")') + .parent().within(() => { + cy.contains('Moderation stage:'); + cy.contains('Manuscript Type Pre-Moderation'); + }); + }); + it("Editor can view all submissions' exhibitors", function () { + cy.login('dbarnes', null, 'publicknowledge'); + cy.get('#active-button').click(); + + cy.waitJQuery(); + cy.get('.listPanel__itemSubtitle:visible:contains("' + submission1 + '")') + .parent().within(() => { + cy.contains('Moderation stage:'); + cy.contains('Area Moderation'); + + cy.contains('Submission made less than a day ago'); + }); + + cy.get('.listPanel__itemSubtitle:visible:contains("' + submission2 + '")') + .parent().within(() => { + cy.contains('Moderation stage:'); + cy.contains('Manuscript Type Pre-Moderation'); + + cy.contains('Submission made less than a day ago'); + }); + }); +}); \ No newline at end of file diff --git a/cypress/tests/Test4_submissionIsPosted.spec.js b/cypress/tests/Test4_submissionIsPosted.spec.js deleted file mode 100644 index d751285..0000000 --- a/cypress/tests/Test4_submissionIsPosted.spec.js +++ /dev/null @@ -1,87 +0,0 @@ -function loginAuthorUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAuthorUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAuthorPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function loginAdminUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAdminUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAdminPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function userLogout() { - cy.get(".pkpDropdown.app__headerAction > .pkpButton").click(); - cy.get("a.pkpDropdown__action").contains("Logout").click(); -} - -function submissionStep1() { - cy.get('#sectionId').select('1'); - cy.get('#pkp_submissionChecklist > ul > li > label > input').check(); - cy.get('#privacyConsent').check(); - - cy.get('#submissionStep1 > .formButtons > .submitFormButton').click(); -} - -function submissionStep2() { - cy.get('#submitStep2Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep3() { - cy.get('input[name^="title"]').first().type("Submission test first moderation stage", { delay: 0 }); - cy.get('label').contains('Title').click(); - cy.get('textarea[id^="abstract-"').then((node) => { - cy.setTinyMceContent(node.attr("id"), "Example of abstract"); - }); - cy.get('.section > label:visible').first().click(); - cy.get('ul[id^="en_US-keywords-"]').then(node => { - node.tagit('createTag', "Dummy keyword"); - }); - cy.get('#submitStep3Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep4() { - cy.get('#submitStep4Form > .formButtons > .submitFormButton').click(); - cy.get('.pkp_modal_confirmation > .footer > .ok').click(); -} - -function postSubmission() { - cy.get("#publication-button").click(); - cy.get(".pkpButton:visible").contains("Post").click(); - cy.get('.pkpWorkflow__publishModal').within(() => { - return cy.get('.pkpButton').contains('Post'); - }) - .click(); -} - -function checkOptionSendNextStageIsNotPresent() { - cy.get("a").contains("Assign").click(); - cy.get('#checkboxSendNextStageDiv').should('not.exist'); -} - -describe("SciELO Moderation Stages Plugin - Option to sent submission to next moderation stage when submission is posted", function() { - it("Author user submits", function() { - cy.visit(Cypress.env('baseUrl') + 'index.php/scielo/submissions'); - loginAuthorUser(); - - cy.get('.pkpHeader__actions:visible > a.pkpButton').click(); - submissionStep1(); - submissionStep2(); - submissionStep3(); - submissionStep4(); - userLogout(); - }); - it("Check option to sent submission to next moderation stage does not show when submision is posted", function() { - loginAdminUser(); - cy.wait(3000); - cy.get("#active-button").click(); - cy.get(".listPanel__itemActions:visible > a.pkpButton").first().click(); - - postSubmission(); - cy.wait(3000); - cy.get("#workflow-button").click(); - checkOptionSendNextStageIsNotPresent(); - }); -}); \ No newline at end of file diff --git a/cypress/tests/Test9_hideParticipantsDiscussion.spec.js b/cypress/tests/Test5_hideParticipantsDiscussion.cy.js similarity index 75% rename from cypress/tests/Test9_hideParticipantsDiscussion.spec.js rename to cypress/tests/Test5_hideParticipantsDiscussion.cy.js index ec5cffc..fa70273 100644 --- a/cypress/tests/Test9_hideParticipantsDiscussion.spec.js +++ b/cypress/tests/Test5_hideParticipantsDiscussion.cy.js @@ -1,9 +1,15 @@ +import '../support/commands.js'; + describe('SciELO Moderation Stages - Hide participants discussion', function () { + let submissionTitle = 'Candyman'; + + before(function() { + Cypress.config('defaultCommandTimeout', 4000); + }); + it('Moderators participants are hidden when author opens discussion', function () { cy.login('fpaglieri', null, 'publicknowledge'); - - cy.get('#archive-button').click(); - cy.contains('a','View').click(); + cy.findSubmission('archive', submissionTitle); cy.contains('Discussions').click(); cy.contains('Add discussion').click(); @@ -14,8 +20,7 @@ describe('SciELO Moderation Stages - Hide participants discussion', function () }); it('Participants are not hidden for other roles', function () { cy.login('dbarnes', null, 'publicknowledge'); - cy.get('#archive-button').click(); - cy.contains('View Paglieri').first().click(); + cy.findSubmission('archive', submissionTitle); cy.contains('Add discussion').click(); cy.waitJQuery(); diff --git a/cypress/tests/Test5_lastModerationStage.spec.js b/cypress/tests/Test5_lastModerationStage.spec.js deleted file mode 100644 index 0e4bcbe..0000000 --- a/cypress/tests/Test5_lastModerationStage.spec.js +++ /dev/null @@ -1,97 +0,0 @@ -function loginAuthorUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAuthorUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAuthorPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function loginAdminUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAdminUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAdminPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function userLogout() { - cy.get(".pkpDropdown.app__headerAction > .pkpButton").click(); - cy.get("a.pkpDropdown__action").contains("Logout").click(); -} - -function submissionStep1() { - cy.get('#sectionId').select('1'); - cy.get('#pkp_submissionChecklist > ul > li > label > input').check(); - cy.get('#privacyConsent').check(); - - cy.get('#submissionStep1 > .formButtons > .submitFormButton').click(); -} - -function submissionStep2() { - cy.get('#submitStep2Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep3() { - cy.get('input[name^="title"]').first().type("Submission test first moderation stage", { delay: 0 }); - cy.get('label').contains('Title').click(); - cy.get('textarea[id^="abstract-"').then((node) => { - cy.setTinyMceContent(node.attr("id"), "Example of abstract"); - }); - cy.get('.section > label:visible').first().click(); - cy.get('ul[id^="en_US-keywords-"]').then(node => { - node.tagit('createTag', "Dummy keyword"); - }); - cy.get('#submitStep3Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep4() { - cy.get('#submitStep4Form > .formButtons > .submitFormButton').click(); - cy.get('.pkp_modal_confirmation > .footer > .ok').click(); -} - -function sendSubmissionToNextStage() { - cy.get('a[id^="component-grid-users-stageparticipant-stageparticipantgrid-requestAccount"]').contains("Assign").click(); - cy.wait(500); - cy.get('tr[id^="component-grid-users-userselect-userselectgrid-row"] > .first_column > input').first().click(); - cy.get('#checkboxSendNextStageAssignYes').click(); - cy.get("#addParticipantForm > .formButtons > .submitFormButton").click(); - cy.wait(3000); -} - -function checkSendingNextStageInAssignmentIsNotPresent() { - cy.get('a[id^="component-grid-users-stageparticipant-stageparticipantgrid-requestAccount"]').contains("Assign").click(); - cy.get('#checkboxSendNextStageDiv').should('not.exist'); - cy.get('.cancelButton').click(); -} - -function checkTryingSendNextStageDoesntWork() { - cy.get('#publication-button').click(); - cy.get('#scieloModerationStages-button').click(); - cy.get('#checkboxSendNextStageMenuYes').click(); - cy.get('#moderationStageSubmit').click(); - cy.reload(); - cy.get('#scieloModerationStages-button'); -} - -describe("SciELO Moderation Stages Plugin - Option to sent submission to next moderation stage when submission in last stage", function() { - it("Author user submits", function() { - cy.visit(Cypress.env('baseUrl') + 'index.php/scielo/submissions'); - loginAuthorUser(); - - cy.get('.pkpHeader__actions:visible > a.pkpButton').click(); - submissionStep1(); - submissionStep2(); - submissionStep3(); - submissionStep4(); - userLogout(); - }); - it("Check the options to send submission to next moderation stage behavior when submission is in last moderation stage", function() { - loginAdminUser(); - cy.wait(3000); - cy.get("#active-button").click(); - cy.get(".listPanel__itemActions:visible > a.pkpButton").first().click(); - - sendSubmissionToNextStage(); - sendSubmissionToNextStage(); - checkSendingNextStageInAssignmentIsNotPresent(); - checkTryingSendNextStageDoesntWork(); - }); -}); \ No newline at end of file diff --git a/cypress/tests/Test6_stagesViewMenu.spec.js b/cypress/tests/Test6_stagesViewMenu.spec.js deleted file mode 100644 index 39b7fec..0000000 --- a/cypress/tests/Test6_stagesViewMenu.spec.js +++ /dev/null @@ -1,81 +0,0 @@ -function loginAuthorUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAuthorUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAuthorPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function loginAdminUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAdminUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAdminPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function userLogout() { - cy.get(".pkpDropdown.app__headerAction > .pkpButton").click(); - cy.get("a.pkpDropdown__action").contains("Logout").click(); -} - -function submissionStep1() { - cy.get('#sectionId').select('1'); - cy.get('#pkp_submissionChecklist > ul > li > label > input').check(); - cy.get('#privacyConsent').check(); - - cy.get('#submissionStep1 > .formButtons > .submitFormButton').click(); -} - -function submissionStep2() { - cy.get('#submitStep2Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep3() { - cy.get('input[name^="title"]').first().type("Submission test first moderation stage", { delay: 0 }); - cy.get('label').contains('Title').click(); - cy.get('textarea[id^="abstract-"').then((node) => { - cy.setTinyMceContent(node.attr("id"), "Example of abstract"); - }); - cy.get('.section > label:visible').first().click(); - cy.get('ul[id^="en_US-keywords-"]').then(node => { - node.tagit('createTag', "Dummy keyword"); - }); - cy.get('#submitStep3Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep4() { - cy.get('#submitStep4Form > .formButtons > .submitFormButton').click(); - cy.get('.pkp_modal_confirmation > .footer > .ok').click(); -} - -function checkOptionSendNextStageIsPresent() { - cy.contains("This submission is in the Format Pre-Moderation stage, do you want to send it to the Content Pre-Moderation stage?"); - cy.get('#checkboxSendNextStageMenuYes').parent().contains("Yes"); - cy.get('#checkboxSendNextStageMenuNo').parent().contains("No"); - cy.get('#checkboxSendNextStageMenuYes').should('not.be.checked'); - cy.get('#checkboxSendNextStageMenuNo').should('be.checked'); -} - -describe("SciELO Moderation Stages Plugin - Menu for view/edit moderation stage entry dates", function() { - it("Author user submits", function() { - cy.visit(Cypress.env('baseUrl') + 'index.php/scielo/submissions'); - loginAuthorUser(); - - cy.get('.pkpHeader__actions:visible > a.pkpButton').click(); - submissionStep1(); - submissionStep2(); - submissionStep3(); - submissionStep4(); - userLogout(); - }); - it("Check if menu for view/edit moderation stage entry dates is present in preprint view", function() { - loginAdminUser(); - cy.wait(3000); - cy.get("#active-button").click(); - cy.get(".listPanel__itemActions:visible > a.pkpButton").first().click(); - - cy.get("#publication-button").click(); - cy.get(".pkpTabs__buttons > #scieloModerationStages-button").click(); - cy.get('label').contains('Format Pre-Moderation'); - checkOptionSendNextStageIsPresent(); - }); -}); \ No newline at end of file diff --git a/cypress/tests/Test7_currentStageOnSubmissionPage.spec.js b/cypress/tests/Test7_currentStageOnSubmissionPage.spec.js deleted file mode 100644 index aa3e284..0000000 --- a/cypress/tests/Test7_currentStageOnSubmissionPage.spec.js +++ /dev/null @@ -1,71 +0,0 @@ -function loginAuthorUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAuthorUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAuthorPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function loginAdminUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAdminUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAdminPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function userLogout() { - cy.get(".pkpDropdown.app__headerAction > .pkpButton").click(); - cy.get("a.pkpDropdown__action").contains("Logout").click(); -} - -function submissionStep1() { - cy.get('#sectionId').select('1'); - cy.get('#pkp_submissionChecklist > ul > li > label > input').check(); - cy.get('#privacyConsent').check(); - - cy.get('#submissionStep1 > .formButtons > .submitFormButton').click(); -} - -function submissionStep2() { - cy.get('#submitStep2Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep3() { - cy.get('input[name^="title"]').first().type("Submission test first moderation stage", { delay: 0 }); - cy.get('label').contains('Title').click(); - cy.get('textarea[id^="abstract-"').then((node) => { - cy.setTinyMceContent(node.attr("id"), "Example of abstract"); - }); - cy.get('.section > label:visible').first().click(); - cy.get('ul[id^="en_US-keywords-"]').then(node => { - node.tagit('createTag', "Dummy keyword"); - }); - cy.get('#submitStep3Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep4() { - cy.get('#submitStep4Form > .formButtons > .submitFormButton').click(); - cy.get('.pkp_modal_confirmation > .footer > .ok').click(); -} - -describe("SciELO Moderation Stages Plugin - Exhibitor of submission's current stage in submission's page", function() { - it("Author user submits", function() { - cy.visit(Cypress.env('baseUrl') + 'index.php/scielo/submissions'); - loginAuthorUser(); - - cy.get('.pkpHeader__actions:visible > a.pkpButton').click(); - submissionStep1(); - submissionStep2(); - submissionStep3(); - submissionStep4(); - userLogout(); - }); - it("Check if current moderation stage exhibitor appears in submission's page", function() { - loginAdminUser(); - cy.wait(3000); - cy.get("#active-button").click(); - cy.get(".listPanel__itemActions:visible > a.pkpButton").first().click(); - cy.get("#publication-button").click(); - cy.get(".moderationStageStatus > strong").contains("Moderation stage:"); - cy.get(".moderationStageStatus > span").contains("Format Pre-Moderation"); - }); -}); \ No newline at end of file diff --git a/cypress/tests/Test8_pastTimeOnSubmissionsList.spec.js b/cypress/tests/Test8_pastTimeOnSubmissionsList.spec.js deleted file mode 100644 index ef5cbc0..0000000 --- a/cypress/tests/Test8_pastTimeOnSubmissionsList.spec.js +++ /dev/null @@ -1,119 +0,0 @@ -function loginAuthorUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAuthorUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAuthorPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function loginAdminUser() { - cy.get('input[id=username]').clear(); - cy.get('input[id=username]').type(Cypress.env('OJSAdminUsername'), { delay: 0 }); - cy.get('input[id=password]').type(Cypress.env('OJSAdminPassword'), { delay: 0 }); - cy.get('button[class=submit]').click(); -} - -function userLogout() { - cy.get(".pkpDropdown.app__headerAction > .pkpButton").click(); - cy.get("a.pkpDropdown__action").contains("Logout").click(); -} - -function submissionStep1() { - cy.get('#sectionId').select('1'); - cy.get('#pkp_submissionChecklist > ul > li > label > input').check(); - cy.get('#privacyConsent').check(); - - cy.get('#submissionStep1 > .formButtons > .submitFormButton').click(); -} - -function submissionStep2() { - cy.get('#submitStep2Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep3() { - cy.get('input[name^="title"]').first().type("Submission test past time in submissions listing", { delay: 0 }); - cy.get('label').contains('Title').click(); - cy.get('textarea[id^="abstract-"').then((node) => { - cy.setTinyMceContent(node.attr("id"), "Example of abstract"); - }); - cy.get('.section > label:visible').first().click(); - cy.get('ul[id^="en_US-keywords-"]').then(node => { - node.tagit('createTag', "Dummy keyword"); - }); - cy.get('#submitStep3Form > .formButtons > .submitFormButton').click(); -} - -function submissionStep4() { - cy.get('#submitStep4Form > .formButtons > .submitFormButton').click(); - cy.get('.pkp_modal_confirmation > .footer > .ok').click(); -} - -function assignUser(userGroupName) { - cy.get('a[id^="component-grid-users-stageparticipant-stageparticipantgrid-requestAccount"]').contains("Assign").click(); - cy.get('select[name^="filterUserGroupId"]').select(userGroupName); - cy.get('button').contains('Search').click(); - cy.wait(500); - cy.get('tr[id^="component-grid-users-userselect-userselectgrid-row"] > .first_column > input').first().click(); - cy.get('#checkboxSendNextStageAssignNo').click(); - cy.get("#addParticipantForm > .formButtons > .submitFormButton").click(); - cy.wait(3000); -} - -function assignResponsibleUser() { - assignUser('Responsible'); -} - -function assignAreaModeratorUser() { - assignUser('Area Moderator'); -} - -describe("SciELO Moderation Stages Plugin - Past time exhibitors in submissions listing page", function() { - it("Author user submits", function() { - cy.visit(Cypress.env('baseUrl') + 'index.php/scielo/submissions'); - loginAuthorUser(); - - cy.get('.pkpHeader__actions:visible > a.pkpButton').click(); - submissionStep1(); - submissionStep2(); - submissionStep3(); - submissionStep4(); - userLogout(); - }); - it("Assign responsible and area moderator users", function() { - loginAdminUser(); - cy.wait(3000); - cy.get("#active-button").click(); - cy.get("a.pkpButton:visible").contains("View").first().click(); - assignResponsibleUser(); - cy.reload(); - assignAreaModeratorUser(); - }); - it("Check if past time exhibitors appear in submissions listing", function() { - cy.get(".app__navItem").contains("Submissions").click(); - cy.get("#active-button").click(); - cy.get(".listPanel__itemIdentity:visible > .exhibitorsSeparator").first(); - cy.get(".listPanel__itemIdentity:visible > .listPanel__itemTimeSubmitted") - .first() - .contains('Submission made less than a day ago'); - cy.get(".listPanel__itemIdentity:visible > .listPanel__itemTimeResponsible") - .first() - .contains('Responsible assigned less than a day ago'); - cy.get(".listPanel__itemIdentity:visible > .listPanel__itemTimeAreaModerator") - .first() - .contains('Area moderator assigned less than a day ago'); - cy.logout(); - }); - it("Check if past time exhibitors do not appear for authors", function() { - loginAuthorUser(); - cy.get('.listPanel__itemModerationStage').within(() => { - cy.contains('Moderation stage:'); - cy.contains('Format Pre-Moderation'); - }); - - cy.contains('Responsible:').should('not.exist'); - cy.contains('Area moderator:').should('not.exist'); - - cy.contains('Submission made').should('not.exist'); - cy.contains('Responsible assigned').should('not.exist'); - cy.contains('Area moderator assigned').should('not.exist'); - }); -}); \ No newline at end of file diff --git a/index.php b/index.php deleted file mode 100644 index fca7cd4..0000000 --- a/index.php +++ /dev/null @@ -1,21 +0,0 @@ -submission = $this->createSubmission(); $this->moderationStage = new ModerationStage($this->submission); } - private function createSubmission() + private function createSubmission(): Submission { $submission = new Submission(); - $submission->setData('currentModerationStage', SCIELO_MODERATION_STAGE_FORMAT); + $submission->setData('currentModerationStage', ModerationStage::SCIELO_MODERATION_STAGE_FORMAT); return $submission; } @@ -30,7 +29,6 @@ public function testGetCurrentStageName(): void $this->assertEquals($expectedStageName, $this->moderationStage->getCurrentStageName()); } - public function testGetNextStageName(): void { $expectedStageName = __('plugins.generic.scieloModerationStages.stages.contentStage'); @@ -49,7 +47,7 @@ public function testSubmissionDataNextStage(): void { $this->moderationStage->sendNextStage(); - $this->assertEquals(SCIELO_MODERATION_STAGE_CONTENT, $this->submission->getData('currentModerationStage')); + $this->assertEquals(ModerationStage::SCIELO_MODERATION_STAGE_CONTENT, $this->submission->getData('currentModerationStage')); $this->assertEquals(Core::getCurrentDate(), $this->submission->getData('lastModerationStageChange')); $this->assertEquals(Core::getCurrentDate(), $this->submission->getData('contentStageEntryDate')); } @@ -66,21 +64,21 @@ public function testPutOnFirstStage(): void public function testRejectedSubmissionCantAdvanceStage(): void { - $this->submission->setData('status', STATUS_DECLINED); + $this->submission->setData('status', Submission::STATUS_DECLINED); $moderationStage = new ModerationStage($this->submission); $this->assertFalse($moderationStage->canAdvanceStage()); } public function testPostedSubmissionCantAdvanceStage(): void { - $this->submission->setData('status', STATUS_PUBLISHED); + $this->submission->setData('status', Submission::STATUS_PUBLISHED); $moderationStage = new ModerationStage($this->submission); $this->assertFalse($moderationStage->canAdvanceStage()); } public function testSubmissionOnLastStageCantAdvance(): void { - $this->submission->setData('currentModerationStage', SCIELO_MODERATION_STAGE_AREA); + $this->submission->setData('currentModerationStage', ModerationStage::SCIELO_MODERATION_STAGE_AREA); $moderationStage = new ModerationStage($this->submission); $this->assertFalse($moderationStage->canAdvanceStage()); } diff --git a/version.xml b/version.xml index 46ba722..c8af828 100644 --- a/version.xml +++ b/version.xml @@ -3,8 +3,8 @@ @@ -13,7 +13,7 @@ scieloModerationStages plugins.generic 0 - 1.5.5.0 - 2023-12-01 + 2.0.0.0 + 2024-02-01 ScieloModerationStagesPlugin