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
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;