assertInstanceOf(TaskLogCategorizedStatus::class, $status); } /** * @throws Exception */ public function testCreateWithInvalidStatus() { $this->expectException(Exception::class); TaskLogCategorizedStatus::createFromString('some invalid status'); } /** * @throws Exception */ public function testStatusAreMappedCorrectly() { $status = TaskLogCategorizedStatus::createFromString('enqueued'); $this->assertSame('created', (string)$status); $status = TaskLogCategorizedStatus::createFromString('dequeued'); $this->assertSame('in_progress', (string)$status); $status = TaskLogCategorizedStatus::createFromString('running'); $this->assertSame('in_progress', (string)$status); $status = TaskLogCategorizedStatus::createFromString('completed'); $this->assertSame('completed', (string)$status); $status = TaskLogCategorizedStatus::createFromString('failed'); $this->assertSame('failed', (string)$status); $status = TaskLogCategorizedStatus::createFromString('unknown'); $this->assertSame('failed', (string)$status); } /** * @throws Exception */ public function testStatusEquals() { $statusRunning = TaskLogCategorizedStatus::createFromString('dequeued'); $this->assertTrue($statusRunning->equals(TaskLogCategorizedStatus::createFromString('dequeued'))); $statusCompleted = TaskLogCategorizedStatus::createFromString('completed'); $this->assertTrue($statusCompleted->equals(TaskLogCategorizedStatus::createFromString('completed'))); $statusFailed = TaskLogCategorizedStatus::createFromString('failed'); $this->assertTrue($statusFailed->equals(TaskLogCategorizedStatus::createFromString('unknown'))); $this->assertFalse($statusRunning->equals($statusCompleted)); $this->assertFalse($statusCompleted->equals($statusFailed)); } }