log = new ExchangeLog(); } #[\PHPUnit\Framework\Attributes\Group('module')] public function testDefault() : void { self::assertEquals(0, $this->log->id); self::assertEquals('', $this->log->message); self::assertEquals('', $this->log->subtype); self::assertEquals(0, $this->log->exchange); self::assertEquals(0, $this->log->createdBy); self::assertEquals(ExchangeType::IMPORT, $this->log->type); self::assertInstanceOf('\DateTimeImmutable', $this->log->createdAt); } #[\PHPUnit\Framework\Attributes\Group('module')] public function testFieldsInputOutput() : void { $this->log->setFields($fields = [ 'name' => 'test', 'start' => 'now', ]); self::assertEquals($fields, $this->log->getFields()); } #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { $this->log->message = '123456'; $this->log->type = ExchangeType::EXPORT; $serialized = $this->log->jsonSerialize(); unset($serialized['createdAt']); self::assertEquals( [ 'id' => 0, 'message' => '123456', 'type' => ExchangeType::EXPORT, 'fields' => [], ], $serialized ); } }