Use "automation" instead of "workflow" in user-facing strings

[MAILPOET-4758]
This commit is contained in:
Jan Jakes
2022-11-02 21:29:35 +01:00
committed by David Remer
parent ccb5369c57
commit dc5e5b4f8b
39 changed files with 88 additions and 88 deletions

View File

@ -21,7 +21,7 @@ export function TrashButton(): JSX.Element {
<> <>
<ConfirmDialog <ConfirmDialog
isOpen={showConfirmDialog} isOpen={showConfirmDialog}
title={__('Delete workflow', 'mailpoet')} title={__('Delete automation', 'mailpoet')}
confirmButtonText={__('Yes, delete', 'mailpoet')} confirmButtonText={__('Yes, delete', 'mailpoet')}
onConfirm={async () => { onConfirm={async () => {
trash(() => { trash(() => {
@ -32,7 +32,7 @@ export function TrashButton(): JSX.Element {
__experimentalHideHeader={false} __experimentalHideHeader={false}
> >
{sprintf( {sprintf(
__('You are about to delete the "%s" workflow.', 'mailpoet'), __('You are about to delete the automation "%s".', 'mailpoet'),
workflow.name, workflow.name,
)} )}
<br /> <br />

View File

@ -68,7 +68,7 @@ export function DocumentActions({ children }): JSX.Element {
as="h1" as="h1"
> >
<VisuallyHidden as="span"> <VisuallyHidden as="span">
{__('Editing workflow:', 'mailpoet')} {__('Editing automation:', 'mailpoet')}
</VisuallyHidden> </VisuallyHidden>
{workflowName} {workflowName}
</Text> </Text>
@ -93,7 +93,7 @@ export function DocumentActions({ children }): JSX.Element {
aria-expanded={isOpen} aria-expanded={isOpen}
aria-haspopup="true" aria-haspopup="true"
onClick={onToggle} onClick={onToggle}
label={__('Change workflow name', 'mailpoet')} label={__('Change automation name', 'mailpoet')}
> >
{showIconLabels && __('Rename', 'mailpoet')} {showIconLabels && __('Rename', 'mailpoet')}
</Button> </Button>

View File

@ -151,12 +151,12 @@ export function Errors(): JSX.Element | null {
<Composite <Composite
state={compositeState} state={compositeState}
role="list" role="list"
aria-label={__('Workflow errors', 'mailpoet')} aria-label={__('Automation errors', 'mailpoet')}
className="mailpoet-automation-errors" className="mailpoet-automation-errors"
> >
<div className="mailpoet-automation-errors-header"> <div className="mailpoet-automation-errors-header">
{ {
// translators: Label for a list of automation workflow steps that are incomplete or have errors // translators: Label for a list of automation steps that are incomplete or have errors
__('The following steps are not fully set:', 'mailpoet') __('The following steps are not fully set:', 'mailpoet')
} }
</div> </div>

View File

@ -18,8 +18,8 @@ export function Header({ sidebarKey }: Props): JSX.Element {
const [workflowAriaLabel, workflowActiveClass] = const [workflowAriaLabel, workflowActiveClass] =
sidebarKey === workflowSidebarKey sidebarKey === workflowSidebarKey
? [__('Workflow (selected)', 'mailpoet'), 'is-active'] ? [__('Automation (selected)', 'mailpoet'), 'is-active']
: ['Workflow', '']; : ['Automation', ''];
const [stepAriaLabel, stepActiveClass] = const [stepAriaLabel, stepActiveClass] =
sidebarKey === stepSidebarKey sidebarKey === stepSidebarKey
@ -33,9 +33,9 @@ export function Header({ sidebarKey }: Props): JSX.Element {
onClick={openWorkflowSettings} onClick={openWorkflowSettings}
className={`edit-site-sidebar__panel-tab ${workflowActiveClass}`} className={`edit-site-sidebar__panel-tab ${workflowActiveClass}`}
aria-label={workflowAriaLabel} aria-label={workflowAriaLabel}
data-label={__('Workflow', 'mailpoet')} data-label={__('Automation', 'mailpoet')}
> >
{__('Workflow', 'mailpoet')} {__('Automation', 'mailpoet')}
</Button> </Button>
</li> </li>
<li> <li>

View File

@ -3,7 +3,7 @@ import { __ } from '@wordpress/i18n';
export function EmptyWorkflow(): JSX.Element { export function EmptyWorkflow(): JSX.Element {
return ( return (
<div className="mailpoet-automation-editor-empty-workflow"> <div className="mailpoet-automation-editor-empty-workflow">
{__('No workflow data.', 'mailpoet')} {__('No automation data.', 'mailpoet')}
</div> </div>
); );
} }

View File

@ -90,7 +90,7 @@ export function Workflow(): JSX.Element {
<Composite <Composite
state={compositeState} state={compositeState}
role="tree" role="tree"
aria-label={__('Workflow', 'mailpoet')} aria-label={__('Automation', 'mailpoet')}
aria-orientation="vertical" aria-orientation="vertical"
className="mailpoet-automation-editor-workflow" className="mailpoet-automation-editor-workflow"
> >

View File

@ -17,19 +17,19 @@ export function Statistics(): JSX.Element {
items={[ items={[
{ {
key: 'entered', key: 'entered',
// translators: Total number of subscribers who entered an automation workflow // translators: Total number of subscribers who entered an automation
label: _x('Total Entered', 'automation stats', 'mailpoet'), label: _x('Total Entered', 'automation stats', 'mailpoet'),
value: workflow.stats.totals.entered, value: workflow.stats.totals.entered,
}, },
{ {
key: 'processing', key: 'processing',
// translators: Total number of subscribers who are being processed in an automation workflow // translators: Total number of subscribers who are being processed in an automation
label: _x('Total Processing', 'automation stats', 'mailpoet'), label: _x('Total Processing', 'automation stats', 'mailpoet'),
value: workflow.stats.totals.in_progress, value: workflow.stats.totals.in_progress,
}, },
{ {
key: 'exited', key: 'exited',
// translators: Total number of subscribers who exited an automation workflow, no matter the result // translators: Total number of subscribers who exited an automation, no matter the result
label: _x('Total Exited', 'automation stats', 'mailpoet'), label: _x('Total Exited', 'automation stats', 'mailpoet'),
value: workflow.stats.totals.exited, value: workflow.stats.totals.exited,
}, },

View File

@ -97,7 +97,7 @@ export function EditNewsletter(): JSX.Element {
{emailIdError && ( {emailIdError && (
<span className="mailpoet-automation-field-message"> <span className="mailpoet-automation-field-message">
{__( {__(
'You need to design an email before you can activate the workflow', 'You need to design an email before you can activate the automation',
'mailpoet', 'mailpoet',
)} )}
</span> </span>

View File

@ -13,19 +13,19 @@ export function Subscribers({ workflow }: Props): JSX.Element {
items={[ items={[
{ {
key: 'entered', key: 'entered',
// translators: Total number of subscribers who entered an automation workflow // translators: Total number of subscribers who entered an automation
label: _x('Entered', 'automation stats', 'mailpoet'), label: _x('Entered', 'automation stats', 'mailpoet'),
value: workflow.stats.totals.entered, value: workflow.stats.totals.entered,
}, },
{ {
key: 'processing', key: 'processing',
// translators: Total number of subscribers who are being processed in an automation workflow // translators: Total number of subscribers who are being processed in an automation
label: _x('Processing', 'automation stats', 'mailpoet'), label: _x('Processing', 'automation stats', 'mailpoet'),
value: workflow.stats.totals.in_progress, value: workflow.stats.totals.in_progress,
}, },
{ {
key: 'exited', key: 'exited',
// translators: Total number of subscribers who exited an automation workflow, no matter the result // translators: Total number of subscribers who exited an automation, no matter the result
label: _x('Exited', 'automation stats', 'mailpoet'), label: _x('Exited', 'automation stats', 'mailpoet'),
value: workflow.stats.totals.exited, value: workflow.stats.totals.exited,
}, },

View File

@ -31,7 +31,7 @@ export const useDeleteButton = (workflow: Workflow): Item | undefined => {
onCancel={() => setShowDialog(false)} onCancel={() => setShowDialog(false)}
> >
{sprintf( {sprintf(
// translators: %s is the workflow name // translators: %s is the automation name
__( __(
'Are you sure you want to permanently delete "%s" and all associated data? This cannot be undone!', 'Are you sure you want to permanently delete "%s" and all associated data? This cannot be undone!',
'mailpoet', 'mailpoet',

View File

@ -24,16 +24,16 @@ export const useTrashButton = (workflow: Workflow): Item | undefined => {
slot: ( slot: (
<ConfirmDialog <ConfirmDialog
isOpen={showDialog} isOpen={showDialog}
title={__('Trash workflow', 'mailpoet')} title={__('Trash automation', 'mailpoet')}
confirmButtonText={__('Yes, move to trash', 'mailpoet')} confirmButtonText={__('Yes, move to trash', 'mailpoet')}
__experimentalHideHeader={false} __experimentalHideHeader={false}
onConfirm={() => trashWorkflow(workflow)} onConfirm={() => trashWorkflow(workflow)}
onCancel={() => setShowDialog(false)} onCancel={() => setShowDialog(false)}
> >
{sprintf( {sprintf(
// translators: %s is the workflow name // translators: %s is the automation name
__( __(
'Are you sure you want to move the workflow "%s" to the Trash?', 'Are you sure you want to move the automation "%s" to the Trash?',
'mailpoet', 'mailpoet',
), ),
workflow.name, workflow.name,

View File

@ -32,7 +32,7 @@ export function* duplicateWorkflow(workflow: Workflow) {
}); });
void createSuccessNotice( void createSuccessNotice(
// translators: %s is the automation workflow name // translators: %s is the automation name
sprintf(__('Automation "%s" was duplicated.', 'mailpoet'), workflow.name), sprintf(__('Automation "%s" was duplicated.', 'mailpoet'), workflow.name),
); );
@ -86,7 +86,7 @@ export function* restoreWorkflow(workflow: Workflow, status: WorkflowStatus) {
{message}{' '} {message}{' '}
<EditWorkflow <EditWorkflow
workflow={workflow} workflow={workflow}
label={__('Edit workflow', 'mailpoet')} label={__('Edit automation', 'mailpoet')}
/> />
</p> </p>
), ),

View File

@ -47,7 +47,7 @@ export function WorkflowListingNotices(): JSX.Element {
if (workflowDeleted) { if (workflowDeleted) {
return ( return (
<Notice type="success" closable timeout={false}> <Notice type="success" closable timeout={false}>
<p>{__('1 workflow moved to the Trash.', 'mailpoet')}</p> <p>{__('1 automation moved to the Trash.', 'mailpoet')}</p>
</Notice> </Notice>
); );
} }

View File

@ -16,7 +16,7 @@ export function BuildYourOwnSection(): JSX.Element {
}, },
{ {
slug: 'customize-your-workflow', slug: 'customize-your-workflow',
title: __('Customize your workflow', 'mailpoet'), title: __('Customize your automation', 'mailpoet'),
text: __( text: __(
'Choose steps and create a custom journey to best suit your needs.', 'Choose steps and create a custom journey to best suit your needs.',
'mailpoet', 'mailpoet',
@ -49,7 +49,7 @@ export function BuildYourOwnSection(): JSX.Element {
<section className="mailpoet-automation-section mailpoet-automation-white-background"> <section className="mailpoet-automation-section mailpoet-automation-white-background">
<div className="mailpoet-automation-section-content mailpoet-section-build-your-own"> <div className="mailpoet-automation-section-content mailpoet-section-build-your-own">
<div> <div>
<h2>{__('Build your own automation workflows', 'mailpoet')}</h2> <h2>{__('Build your own automations', 'mailpoet')}</h2>
<p> <p>
{__( {__(
'Create customized email sequences with our new automation editor.', 'Create customized email sequences with our new automation editor.',

View File

@ -37,7 +37,7 @@ export function TemplateListItem({
<p> <p>
{error.data {error.data
? error.data.message ? error.data.message
: __('Could not create workflow.', 'mailpoet')} : __('Could not create automation.', 'mailpoet')}
</p> </p>
</Notice> </Notice>
); );

View File

@ -64,7 +64,7 @@ class AutomationEditor {
if (!$workflow) { if (!$workflow) {
$notice = new WPNotice( $notice = new WPNotice(
WPNotice::TYPE_ERROR, WPNotice::TYPE_ERROR,
__('Workflow not found.', 'mailpoet') __('Automation not found.', 'mailpoet')
); );
$notice->displayWPNotice(); $notice->displayWPNotice();
$this->pageRenderer->displayPage('blank.html'); $this->pageRenderer->displayPage('blank.html');

View File

@ -40,7 +40,7 @@ class CreateWorkflowFromTemplateController {
$workflowId = $this->storage->createWorkflow($workflow); $workflowId = $this->storage->createWorkflow($workflow);
$savedWorkflow = $this->storage->getWorkflow($workflowId); $savedWorkflow = $this->storage->getWorkflow($workflowId);
if (!$savedWorkflow) { if (!$savedWorkflow) {
throw new InvalidStateException('Workflow not found.'); throw new InvalidStateException('Automation not found.');
} }
return $savedWorkflow; return $savedWorkflow;
} }

View File

@ -48,7 +48,7 @@ class DuplicateWorkflowController {
} }
private function getName(string $name): string { private function getName(string $name): string {
// translators: %s is the original workflow name. // translators: %s is the original automation name.
$newName = sprintf(__('Copy of %s', 'mailpoet'), $name); $newName = sprintf(__('Copy of %s', 'mailpoet'), $name);
$maxLength = $this->workflowStorage->getNameColumnLength(); $maxLength = $this->workflowStorage->getNameColumnLength();
if (strlen($newName) > $maxLength) { if (strlen($newName) > $maxLength) {

View File

@ -63,50 +63,50 @@ class Exceptions {
public static function workflowNotFound(int $id): NotFoundException { public static function workflowNotFound(int $id): NotFoundException {
return NotFoundException::create() return NotFoundException::create()
->withErrorCode(self::WORKFLOW_NOT_FOUND) ->withErrorCode(self::WORKFLOW_NOT_FOUND)
// translators: %d is the ID of the workflow. // translators: %d is the ID of the automation.
->withMessage(sprintf(__("Workflow with ID '%d' not found.", 'mailpoet'), $id)); ->withMessage(sprintf(__("Automation with ID '%d' not found.", 'mailpoet'), $id));
} }
public static function workflowVersionNotFound(int $workflow, int $version): NotFoundException { public static function workflowVersionNotFound(int $workflow, int $version): NotFoundException {
return NotFoundException::create() return NotFoundException::create()
->withErrorCode(self::WORKFLOW_VERSION_NOT_FOUND) ->withErrorCode(self::WORKFLOW_VERSION_NOT_FOUND)
// translators: %1$s is the ID of the workflow, %2$s the version. // translators: %1$s is the ID of the automation, %2$s the version.
->withMessage(sprintf(__('Workflow with ID "%1$s" in version "%2$s" not found.', 'mailpoet'), $workflow, $version)); ->withMessage(sprintf(__('Automation with ID "%1$s" in version "%2$s" not found.', 'mailpoet'), $workflow, $version));
} }
public static function workflowNotActive(int $workflow): InvalidStateException { public static function workflowNotActive(int $workflow): InvalidStateException {
return InvalidStateException::create() return InvalidStateException::create()
->withErrorCode(self::WORKFLOW_NOT_ACTIVE) ->withErrorCode(self::WORKFLOW_NOT_ACTIVE)
// translators: %1$s is the ID of the workflow. // translators: %1$s is the ID of the automation.
->withMessage(sprintf(__('Workflow with ID "%1$s" in no longer active.', 'mailpoet'), $workflow)); ->withMessage(sprintf(__('Automation with ID "%1$s" in no longer active.', 'mailpoet'), $workflow));
} }
public static function workflowRunNotFound(int $id): NotFoundException { public static function workflowRunNotFound(int $id): NotFoundException {
return NotFoundException::create() return NotFoundException::create()
->withErrorCode(self::WORKFLOW_RUN_NOT_FOUND) ->withErrorCode(self::WORKFLOW_RUN_NOT_FOUND)
// translators: %d is the ID of the workflow run. // translators: %d is the ID of the automation run.
->withMessage(sprintf(__("Workflow run with ID '%d' not found.", 'mailpoet'), $id)); ->withMessage(sprintf(__("Automation run with ID '%d' not found.", 'mailpoet'), $id));
} }
public static function workflowStepNotFound(string $key): NotFoundException { public static function workflowStepNotFound(string $key): NotFoundException {
return NotFoundException::create() return NotFoundException::create()
->withErrorCode(self::WORKFLOW_STEP_NOT_FOUND) ->withErrorCode(self::WORKFLOW_STEP_NOT_FOUND)
// translators: %s is the key of the workflow step. // translators: %s is the key of the automation step.
->withMessage(sprintf(__("Workflow step with key '%s' not found.", 'mailpoet'), $key)); ->withMessage(sprintf(__("Automation step with key '%s' not found.", 'mailpoet'), $key));
} }
public static function workflowTriggerNotFound(int $workflowId, string $key): NotFoundException { public static function workflowTriggerNotFound(int $workflowId, string $key): NotFoundException {
return NotFoundException::create() return NotFoundException::create()
->withErrorCode(self::WORKFLOW_TRIGGER_NOT_FOUND) ->withErrorCode(self::WORKFLOW_TRIGGER_NOT_FOUND)
// translators: %1$s is the key, %2$d is the workflow ID. // translators: %1$s is the key, %2$d is the automation ID.
->withMessage(sprintf(__('Workflow trigger with key "%1$s" not found in workflow ID "%2$d".', 'mailpoet'), $key, $workflowId)); ->withMessage(sprintf(__('Automation trigger with key "%1$s" not found in automation ID "%2$d".', 'mailpoet'), $key, $workflowId));
} }
public static function workflowRunNotRunning(int $id, string $status): InvalidStateException { public static function workflowRunNotRunning(int $id, string $status): InvalidStateException {
return InvalidStateException::create() return InvalidStateException::create()
->withErrorCode(self::WORKFLOW_RUN_NOT_RUNNING) ->withErrorCode(self::WORKFLOW_RUN_NOT_RUNNING)
// translators: %1$d is the ID of the workflow run, %2$s its current status. // translators: %1$d is the ID of the automation run, %2$s its current status.
->withMessage(sprintf(__('Workflow run with ID "%1$d" is not running. Status: %2$s', 'mailpoet'), $id, $status)); ->withMessage(sprintf(__('Automation run with ID "%1$d" is not running. Status: %2$s', 'mailpoet'), $id, $status));
} }
public static function subjectNotFound(string $key): NotFoundException { public static function subjectNotFound(string $key): NotFoundException {
@ -133,50 +133,50 @@ class Exceptions {
public static function subjectDataNotFound(string $key, int $workflowRunId): NotFoundException { public static function subjectDataNotFound(string $key, int $workflowRunId): NotFoundException {
return NotFoundException::create() return NotFoundException::create()
->withErrorCode(self::SUBJECT_DATA_NOT_FOUND) ->withErrorCode(self::SUBJECT_DATA_NOT_FOUND)
// translators: %1$s is the key of the subject, %2$d is workflow run ID. // translators: %1$s is the key of the subject, %2$d is automation run ID.
->withMessage( ->withMessage(
sprintf(__("Subject data for subject with key '%1\$s' not found for workflow run with ID '%2\$d'.", 'mailpoet'), $key, $workflowRunId) sprintf(__("Subject data for subject with key '%1\$s' not found for automation run with ID '%2\$d'.", 'mailpoet'), $key, $workflowRunId)
); );
} }
public static function multipleSubjectsFound(string $key, int $workflowRunId): InvalidStateException { public static function multipleSubjectsFound(string $key, int $workflowRunId): InvalidStateException {
return InvalidStateException::create() return InvalidStateException::create()
->withErrorCode(self::MULTIPLE_SUBJECTS_FOUND) ->withErrorCode(self::MULTIPLE_SUBJECTS_FOUND)
// translators: %1$s is the key of the subject, %2$d is workflow run ID. // translators: %1$s is the key of the subject, %2$d is automation run ID.
->withMessage( ->withMessage(
sprintf(__("Multiple subjects with key '%1\$s' found for workflow run with ID '%2\$d', only one expected.", 'mailpoet'), $key, $workflowRunId) sprintf(__("Multiple subjects with key '%1\$s' found for automation run with ID '%2\$d', only one expected.", 'mailpoet'), $key, $workflowRunId)
); );
} }
public static function payloadNotFound(string $class, int $workflowRunId): NotFoundException { public static function payloadNotFound(string $class, int $workflowRunId): NotFoundException {
return NotFoundException::create() return NotFoundException::create()
->withErrorCode(self::PAYLOAD_NOT_FOUND) ->withErrorCode(self::PAYLOAD_NOT_FOUND)
// translators: %1$s is the class of the payload, %2$d is workflow run ID. // translators: %1$s is the class of the payload, %2$d is automation run ID.
->withMessage( ->withMessage(
sprintf(__("Payload of class '%1\$s' not found for workflow run with ID '%2\$d'.", 'mailpoet'), $class, $workflowRunId) sprintf(__("Payload of class '%1\$s' not found for automation run with ID '%2\$d'.", 'mailpoet'), $class, $workflowRunId)
); );
} }
public static function multiplePayloadsFound(string $class, int $workflowRunId): NotFoundException { public static function multiplePayloadsFound(string $class, int $workflowRunId): NotFoundException {
return NotFoundException::create() return NotFoundException::create()
->withErrorCode(self::MULTIPLE_PAYLOADS_FOUND) ->withErrorCode(self::MULTIPLE_PAYLOADS_FOUND)
// translators: %1$s is the class of the payloads, %2$d is workflow run ID. // translators: %1$s is the class of the payloads, %2$d is automation run ID.
->withMessage( ->withMessage(
sprintf(__("Multiple payloads of class '%1\$s' found for workflow run with ID '%2\$d'.", 'mailpoet'), $class, $workflowRunId) sprintf(__("Multiple payloads of class '%1\$s' found for automation run with ID '%2\$d'.", 'mailpoet'), $class, $workflowRunId)
); );
} }
public static function workflowStructureModificationNotSupported(): UnexpectedValueException { public static function workflowStructureModificationNotSupported(): UnexpectedValueException {
return UnexpectedValueException::create() return UnexpectedValueException::create()
->withErrorCode(self::WORKFLOW_STRUCTURE_MODIFICATION_NOT_SUPPORTED) ->withErrorCode(self::WORKFLOW_STRUCTURE_MODIFICATION_NOT_SUPPORTED)
->withMessage(__("Workflow structure modification not supported.", 'mailpoet')); ->withMessage(__('Automation structure modification not supported.', 'mailpoet'));
} }
public static function workflowStructureNotValid(string $detail, string $ruleId): UnexpectedValueException { public static function workflowStructureNotValid(string $detail, string $ruleId): UnexpectedValueException {
return UnexpectedValueException::create() return UnexpectedValueException::create()
->withErrorCode(self::WORKFLOW_STRUCTURE_NOT_VALID) ->withErrorCode(self::WORKFLOW_STRUCTURE_NOT_VALID)
// translators: %s is a detailed information // translators: %s is a detailed information
->withMessage(sprintf(__("Invalid workflow structure: %s", 'mailpoet'), $detail)) ->withMessage(sprintf(__("Invalid automation structure: %s", 'mailpoet'), $detail))
->withErrors(['rule_id' => $ruleId]); ->withErrors(['rule_id' => $ruleId]);
} }
@ -198,7 +198,7 @@ class Exceptions {
return UnexpectedValueException::create() return UnexpectedValueException::create()
->withErrorCode(self::WORKFLOW_NOT_VALID) ->withErrorCode(self::WORKFLOW_NOT_VALID)
// translators: %s is a detailed information // translators: %s is a detailed information
->withMessage(sprintf(__("Workflow validation failed: %s", 'mailpoet'), $detail)) ->withMessage(sprintf(__("Automation validation failed: %s", 'mailpoet'), $detail))
->withErrors($errors); ->withErrors($errors);
} }
@ -218,14 +218,14 @@ class Exceptions {
public static function workflowNotTrashed(int $id): UnexpectedValueException { public static function workflowNotTrashed(int $id): UnexpectedValueException {
return UnexpectedValueException::create() return UnexpectedValueException::create()
->withErrorCode(self::WORKFLOW_NOT_TRASHED) ->withErrorCode(self::WORKFLOW_NOT_TRASHED)
// translators: %d is the ID of the workflow. // translators: %d is the ID of the automation.
->withMessage(sprintf(__("Can't delete workflow with ID '%d' because it was not trashed.", 'mailpoet'), $id)); ->withMessage(sprintf(__("Can't delete automation with ID '%d' because it was not trashed.", 'mailpoet'), $id));
} }
public static function workflowTemplateNotFound(string $id): NotFoundException { public static function workflowTemplateNotFound(string $id): NotFoundException {
return NotFoundException::create() return NotFoundException::create()
->withErrorCode(self::WORKFLOW_TEMPLATE_NOT_FOUND) ->withErrorCode(self::WORKFLOW_TEMPLATE_NOT_FOUND)
// translators: %d is the ID of the workflow template. // translators: %d is the ID of the automation template.
->withMessage(sprintf(__("Workflow template with ID '%d' not found.", 'mailpoet'), $id)); ->withMessage(sprintf(__("Automation template with ID '%d' not found.", 'mailpoet'), $id));
} }
} }

View File

@ -15,7 +15,7 @@ class WorkflowWalker {
$steps = $workflow->getSteps(); $steps = $workflow->getSteps();
$root = $steps['root'] ?? null; $root = $steps['root'] ?? null;
if (!$root) { if (!$root) {
throw Exceptions::workflowStructureNotValid(__("Workflow must contain a 'root' step", 'mailpoet'), 'no-root'); throw Exceptions::workflowStructureNotValid(__("Automation must contain a 'root' step", 'mailpoet'), 'no-root');
} }
foreach ($visitors as $visitor) { foreach ($visitors as $visitor) {

View File

@ -28,6 +28,6 @@ class AtLeastOneTriggerRule implements WorkflowNodeVisitor {
if ($this->triggerFound) { if ($this->triggerFound) {
return; return;
} }
throw Exceptions::workflowStructureNotValid(__('There must be at least one trigger in the workflow.', 'mailpoet'), self::RULE_ID); throw Exceptions::workflowStructureNotValid(__('There must be at least one trigger in the automation.', 'mailpoet'), self::RULE_ID);
} }
} }

View File

@ -27,7 +27,7 @@ class NoCycleRule implements WorkflowNodeVisitor {
foreach ($step->getNextSteps() as $nextStep) { foreach ($step->getNextSteps() as $nextStep) {
$nextStepId = $nextStep->getId(); $nextStepId = $nextStep->getId();
if ($nextStepId === $step->getId() || isset($parentIdsMap[$nextStepId])) { if ($nextStepId === $step->getId() || isset($parentIdsMap[$nextStepId])) {
throw Exceptions::workflowStructureNotValid(__('Cycle found in workflow graph', 'mailpoet'), self::RULE_ID); throw Exceptions::workflowStructureNotValid(__('Cycle found in automation graph', 'mailpoet'), self::RULE_ID);
} }
} }
} }

View File

@ -24,7 +24,7 @@ class NoJoinRule implements WorkflowNodeVisitor {
foreach ($step->getNextSteps() as $nextStep) { foreach ($step->getNextSteps() as $nextStep) {
$nextStepId = $nextStep->getId(); $nextStepId = $nextStep->getId();
if (isset($this->visitedSteps[$nextStepId])) { if (isset($this->visitedSteps[$nextStepId])) {
throw Exceptions::workflowStructureNotValid(__('Path join found in workflow graph', 'mailpoet'), self::RULE_ID); throw Exceptions::workflowStructureNotValid(__('Path join found in automation graph', 'mailpoet'), self::RULE_ID);
} }
} }
} }

View File

@ -16,7 +16,7 @@ class NoSplitRule implements WorkflowNodeVisitor {
public function visitNode(Workflow $workflow, WorkflowNode $node): void { public function visitNode(Workflow $workflow, WorkflowNode $node): void {
$step = $node->getStep(); $step = $node->getStep();
if (count($step->getNextSteps()) > 1) { if (count($step->getNextSteps()) > 1) {
throw Exceptions::workflowStructureNotValid(__('Path split found in workflow graph', 'mailpoet'), self::RULE_ID); throw Exceptions::workflowStructureNotValid(__('Path split found in automation graph', 'mailpoet'), self::RULE_ID);
} }
} }

View File

@ -23,7 +23,7 @@ class NoUnreachableStepsRule implements WorkflowNodeVisitor {
public function complete(Workflow $workflow): void { public function complete(Workflow $workflow): void {
if (count($this->visitedNodes) !== count($workflow->getSteps())) { if (count($this->visitedNodes) !== count($workflow->getSteps())) {
throw Exceptions::workflowStructureNotValid(__('Unreachable steps found in workflow graph', 'mailpoet'), self::RULE_ID); throw Exceptions::workflowStructureNotValid(__('Unreachable steps found in automation graph', 'mailpoet'), self::RULE_ID);
} }
} }
} }

View File

@ -32,7 +32,7 @@ class TriggersUnderRootRule implements WorkflowNodeVisitor {
foreach ($step->getNextSteps() as $nextStep) { foreach ($step->getNextSteps() as $nextStep) {
$nextStepId = $nextStep->getId(); $nextStepId = $nextStep->getId();
if (isset($this->triggersMap[$nextStepId])) { if (isset($this->triggersMap[$nextStepId])) {
throw Exceptions::workflowStructureNotValid(__('Trigger must be a direct descendant of workflow root', 'mailpoet'), self::RULE_ID); throw Exceptions::workflowStructureNotValid(__('Trigger must be a direct descendant of automation root', 'mailpoet'), self::RULE_ID);
} }
} }
} }

View File

@ -87,7 +87,7 @@ class StepHandlerTest extends \MailPoetTest
try { try {
$this->testee->handle(['workflow_run_id' => $workflowRun->getId(), 'step_id' => $currentStep->getId()]); $this->testee->handle(['workflow_run_id' => $workflowRun->getId(), 'step_id' => $currentStep->getId()]);
} catch (InvalidStateException $error) { } catch (InvalidStateException $error) {
$this->assertSame('mailpoet_automation_workflow_not_active', $error->getErrorCode(), "Workflow with '$status' did not return expected error code."); $this->assertSame('mailpoet_automation_workflow_not_active', $error->getErrorCode(), "Automation with '$status' did not return expected error code.");
} }
$this->assertInstanceOf(InvalidStateException::class, $error); $this->assertInstanceOf(InvalidStateException::class, $error);

View File

@ -136,7 +136,7 @@ class WorkflowStorageTest extends \MailPoetTest
$workflowId = $this->testee->createWorkflow($workflow); $workflowId = $this->testee->createWorkflow($workflow);
$workflow = $this->testee->getWorkflow($workflowId); $workflow = $this->testee->getWorkflow($workflowId);
if (! $workflow) { if (! $workflow) {
throw new \RuntimeException("Workflow not stored."); throw new \RuntimeException("Automation not stored.");
} }
return $workflow; return $workflow;
} }

View File

@ -53,7 +53,7 @@ class WorkflowsDeleteEndpointTest extends AutomationTest {
$this->assertSame([ $this->assertSame([
'code' => 'mailpoet_automation_workflow_not_trashed', 'code' => 'mailpoet_automation_workflow_not_trashed',
'message' => "Can't delete workflow with ID '{$this->workflow->getId()}' because it was not trashed.", 'message' => "Can't delete automation with ID '{$this->workflow->getId()}' because it was not trashed.",
'data' => ['status' => 400, 'errors' => []], 'data' => ['status' => 400, 'errors' => []],
], $data); ], $data);

View File

@ -13,7 +13,7 @@ class WorkflowWalkerTest extends MailPoetUnitTest {
$workflow = $this->createWorkflow([]); $workflow = $this->createWorkflow([]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage("Invalid workflow structure: Workflow must contain a 'root' step"); $this->expectExceptionMessage("Invalid automation structure: Automation must contain a 'root' step");
$this->walkWorkflow($workflow); $this->walkWorkflow($workflow);
} }
@ -21,7 +21,7 @@ class WorkflowWalkerTest extends MailPoetUnitTest {
$workflow = $this->createWorkflow(['root' => ['a']]); $workflow = $this->createWorkflow(['root' => ['a']]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage("Invalid workflow structure: Step with ID 'a' not found (referenced from 'root')"); $this->expectExceptionMessage("Invalid automation structure: Step with ID 'a' not found (referenced from 'root')");
$this->walkWorkflow($workflow); $this->walkWorkflow($workflow);
} }

View File

@ -30,7 +30,7 @@ class AtLeastOnTriggerTest extends WorkflowRuleTest
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: There must be at least one trigger in the workflow.'); $this->expectExceptionMessage('Invalid automation structure: There must be at least one trigger in the automation.');
(new WorkflowWalker())->walk($workflow, [new AtLeastOneTriggerRule()]); (new WorkflowWalker())->walk($workflow, [new AtLeastOneTriggerRule()]);
} }
} }

View File

@ -15,7 +15,7 @@ class ConsistentStepMapRuleTest extends WorkflowRuleTest {
]]); ]]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage("Invalid workflow structure: Step with ID 'a' stored under a mismatched index 'root'."); $this->expectExceptionMessage("Invalid automation structure: Step with ID 'a' stored under a mismatched index 'root'.");
(new WorkflowWalker())->walk($workflow, [new ConsistentStepMapRule()]); (new WorkflowWalker())->walk($workflow, [new ConsistentStepMapRule()]);
} }

View File

@ -17,7 +17,7 @@ class NoCycleRuleTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Cycle found in workflow graph'); $this->expectExceptionMessage('Invalid automation structure: Cycle found in automation graph');
(new WorkflowWalker())->walk($workflow, [new NoCycleRule()]); (new WorkflowWalker())->walk($workflow, [new NoCycleRule()]);
} }
@ -27,7 +27,7 @@ class NoCycleRuleTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Cycle found in workflow graph'); $this->expectExceptionMessage('Invalid automation structure: Cycle found in automation graph');
(new WorkflowWalker())->walk($workflow, [new NoCycleRule()]); (new WorkflowWalker())->walk($workflow, [new NoCycleRule()]);
} }

View File

@ -15,7 +15,7 @@ class NoDuplicateEdgesTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Duplicate next step definition found'); $this->expectExceptionMessage('Invalid automation structure: Duplicate next step definition found');
(new WorkflowWalker())->walk($workflow, [new NoDuplicateEdgesRule()]); (new WorkflowWalker())->walk($workflow, [new NoDuplicateEdgesRule()]);
} }

View File

@ -17,7 +17,7 @@ class NoJoinRuleTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Path join found in workflow graph'); $this->expectExceptionMessage('Invalid automation structure: Path join found in automation graph');
(new WorkflowWalker())->walk($workflow, [new NoJoinRule()]); (new WorkflowWalker())->walk($workflow, [new NoJoinRule()]);
} }
@ -34,7 +34,7 @@ class NoJoinRuleTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Path join found in workflow graph'); $this->expectExceptionMessage('Invalid automation structure: Path join found in automation graph');
(new WorkflowWalker())->walk($workflow, [new NoJoinRule()]); (new WorkflowWalker())->walk($workflow, [new NoJoinRule()]);
} }
@ -44,7 +44,7 @@ class NoJoinRuleTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Path join found in workflow graph'); $this->expectExceptionMessage('Invalid automation structure: Path join found in automation graph');
(new WorkflowWalker())->walk($workflow, [new NoJoinRule()]); (new WorkflowWalker())->walk($workflow, [new NoJoinRule()]);
} }

View File

@ -16,7 +16,7 @@ class NoSplitRuleTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Path split found in workflow graph'); $this->expectExceptionMessage('Invalid automation structure: Path split found in automation graph');
(new WorkflowWalker())->walk($workflow, [new NoSplitRule()]); (new WorkflowWalker())->walk($workflow, [new NoSplitRule()]);
} }
@ -27,7 +27,7 @@ class NoSplitRuleTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Path split found in workflow graph'); $this->expectExceptionMessage('Invalid automation structure: Path split found in automation graph');
(new WorkflowWalker())->walk($workflow, [new NoSplitRule()]); (new WorkflowWalker())->walk($workflow, [new NoSplitRule()]);
} }

View File

@ -16,7 +16,7 @@ class NoUnreachableStepsRuleTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Unreachable steps found in workflow graph'); $this->expectExceptionMessage('Invalid automation structure: Unreachable steps found in automation graph');
(new WorkflowWalker())->walk($workflow, [new NoUnreachableStepsRule()]); (new WorkflowWalker())->walk($workflow, [new NoUnreachableStepsRule()]);
} }
@ -29,7 +29,7 @@ class NoUnreachableStepsRuleTest extends WorkflowRuleTest {
]); ]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Unreachable steps found in workflow graph'); $this->expectExceptionMessage('Invalid automation structure: Unreachable steps found in automation graph');
$walker = new WorkflowWalker(); $walker = new WorkflowWalker();
(new WorkflowWalker())->walk($workflow, [new NoUnreachableStepsRule()]); (new WorkflowWalker())->walk($workflow, [new NoUnreachableStepsRule()]);
} }

View File

@ -31,7 +31,7 @@ class TriggerNeedsNextStepsRuleTest extends WorkflowRuleTest
$workflow = $this->make(Workflow::class, ['getSteps' => $steps, 'getStep' => function($id) use ($steps) { return $steps[$id]??null; }]); $workflow = $this->make(Workflow::class, ['getSteps' => $steps, 'getStep' => function($id) use ($steps) { return $steps[$id]??null; }]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: A trigger needs to be followed by an action.'); $this->expectExceptionMessage('Invalid automation structure: A trigger needs to be followed by an action.');
(new WorkflowWalker())->walk($workflow, [new TriggerNeedsToBeFollowedByActionRule()]); (new WorkflowWalker())->walk($workflow, [new TriggerNeedsToBeFollowedByActionRule()]);
} }
@ -46,7 +46,7 @@ class TriggerNeedsNextStepsRuleTest extends WorkflowRuleTest
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: A trigger needs to be followed by an action.'); $this->expectExceptionMessage('Invalid automation structure: A trigger needs to be followed by an action.');
(new WorkflowWalker())->walk($workflow, [new TriggerNeedsToBeFollowedByActionRule()]); (new WorkflowWalker())->walk($workflow, [new TriggerNeedsToBeFollowedByActionRule()]);
} }
} }

View File

@ -18,7 +18,7 @@ class TriggersUnderRootRuleTest extends WorkflowRuleTest {
]]); ]]);
$this->expectException(UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Invalid workflow structure: Trigger must be a direct descendant of workflow root'); $this->expectExceptionMessage('Invalid automation structure: Trigger must be a direct descendant of automation root');
(new WorkflowWalker())->walk($workflow, [new TriggersUnderRootRule()]); (new WorkflowWalker())->walk($workflow, [new TriggersUnderRootRule()]);
} }