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;