Fix test: If activated_at is null the status has to be draft

[MAILPOET-4531]
This commit is contained in:
David Remer
2022-10-13 12:29:21 +03:00
committed by David Remer
parent 4931ab47cb
commit 03cfeaac7f

View File

@ -114,19 +114,16 @@ class WorkflowsGetTest extends AutomationTest {
} }
// Check activated_at behavior // Check activated_at behavior
if (isset($expectation['status']) && $expectation['status'] !== Workflow::STATUS_DRAFT) { if ($data['activated_at'] === null) {
$this->assertNotNull($data['activated_at']); $this->assertEquals(Workflow::STATUS_DRAFT, $data['status']);
//Check we can read the date correctly. } else {
$date = null; $activatedAt = null;
try { try {
$date = new \DateTimeImmutable($data['activated_at']); $activatedAt = new \DateTimeImmutable($data['activated_at']);
} finally { } 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. // Check the date time fields are convertible.
$updatedAt = null; $updatedAt = null;