From c140eea734e2c59bcde100c08da2443ad3d15d45 Mon Sep 17 00:00:00 2001 From: David Remer Date: Fri, 21 Oct 2022 13:25:24 +0300 Subject: [PATCH] Adjust DelayActionTest to new error format [MAILPOET-4700] --- .../Integrations/Core/Actions/DelayActionTest.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mailpoet/tests/integration/Automation/Integrations/Core/Actions/DelayActionTest.php b/mailpoet/tests/integration/Automation/Integrations/Core/Actions/DelayActionTest.php index b82a5ed13f..78ca092032 100644 --- a/mailpoet/tests/integration/Automation/Integrations/Core/Actions/DelayActionTest.php +++ b/mailpoet/tests/integration/Automation/Integrations/Core/Actions/DelayActionTest.php @@ -98,12 +98,15 @@ class DelayActionTest extends \MailPoetTest { $workflow = $this->createMock(Workflow::class); $actionScheduler = $this->createMock(ActionScheduler::class); - if ($expectation) { - $this->expectException(ValidationException::class); - $this->expectExceptionMessage($expectation); - } $testee = new DelayAction($actionScheduler); - $testee->validate(new StepValidationArgs($workflow, $step, [])); + try { + $testee->validate(new StepValidationArgs($workflow, $step, [])); + } catch (\Throwable $error) { + if (! $expectation || ! $error instanceof ValidationException) { + throw $error; + } + $this->assertSame($expectation, $error->getErrors()['delay']); + } } public function dataForTestDelayActionInvalidatesOutsideOfBoundaries() : array {