From 03cfeaac7fe04bcf39abc29b8c8422a093fbdea8 Mon Sep 17 00:00:00 2001 From: David Remer Date: Thu, 13 Oct 2022 12:29:21 +0300 Subject: [PATCH] Fix test: If activated_at is null the status has to be draft [MAILPOET-4531] --- .../Automation/Workflows/WorkflowsGetTest.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/mailpoet/tests/integration/REST/Automation/Workflows/WorkflowsGetTest.php b/mailpoet/tests/integration/REST/Automation/Workflows/WorkflowsGetTest.php index 1ba8e8a972..2184fdb6c3 100644 --- a/mailpoet/tests/integration/REST/Automation/Workflows/WorkflowsGetTest.php +++ b/mailpoet/tests/integration/REST/Automation/Workflows/WorkflowsGetTest.php @@ -114,19 +114,16 @@ class WorkflowsGetTest extends AutomationTest { } // Check activated_at behavior - if (isset($expectation['status']) && $expectation['status'] !== Workflow::STATUS_DRAFT) { - $this->assertNotNull($data['activated_at']); - //Check we can read the date correctly. - $date = null; + if ($data['activated_at'] === null) { + $this->assertEquals(Workflow::STATUS_DRAFT, $data['status']); + } else { + $activatedAt = null; try { - $date = new \DateTimeImmutable($data['activated_at']); + $activatedAt = new \DateTimeImmutable($data['activated_at']); } finally { - $this->assertInstanceOf(\DateTimeImmutable::class, $date); + $this->assertInstanceOf(\DateTimeImmutable::class, $activatedAt); } } - if (isset($expectation['status']) && $expectation['status'] === Workflow::STATUS_DRAFT) { - $this->assertNull($data['activated_at']); - } // Check the date time fields are convertible. $updatedAt = null;