value = new TicketAttributeValue(); } /** * @covers Modules\Support\Models\TicketAttributeValue * @group module */ public function testDefault() : void { self::assertEquals(0, $this->value->getId()); self::assertNull($this->value->getValue()); } /** * @covers Modules\Support\Models\TicketAttributeValue * @group module */ public function testLanguageInputOutput() : void { $this->value->setLanguage(ISO639x1Enum::_DE); self::assertEquals(ISO639x1Enum::_DE, $this->value->getLanguage()); } /** * @covers Modules\Support\Models\TicketAttributeValue * @group module */ public function testCountryInputOutput() : void { $this->value->setCountry(ISO3166TwoEnum::_DEU); self::assertEquals(ISO3166TwoEnum::_DEU, $this->value->getCountry()); } /** * @covers Modules\Support\Models\TicketAttributeValue * @group module */ public function testValueIntInputOutput() : void { $this->value->setValue(1); self::assertEquals(1, $this->value->getValue()); } /** * @covers Modules\Support\Models\TicketAttributeValue * @group module */ public function testValueFloatInputOutput() : void { $this->value->setValue(1.1); self::assertEquals(1.1, $this->value->getValue()); } /** * @covers Modules\Support\Models\TicketAttributeValue * @group module */ public function testValueStringInputOutput() : void { $this->value->setValue('test'); self::assertEquals('test', $this->value->getValue()); } /** * @covers Modules\Support\Models\TicketAttributeValue * @group module */ public function testValueDateInputOutput() : void { $this->value->setValue($dat = new \DateTime('now')); self::assertEquals($dat->format('Y-m-d'), $this->value->getValue()->format('Y-m-d')); } /** * @covers Modules\Support\Models\TicketAttributeValue * @group module */ public function testSerialize() : void { $this->value->type = 1; $this->value->setValue('test'); $this->value->isDefault = true; $this->value->setLanguage(ISO639x1Enum::_DE); $this->value->setCountry(ISO3166TwoEnum::_DEU); self::assertEquals( [ 'id' => 0, 'type' => 1, 'valueInt' => null, 'valueStr' => 'test', 'valueDec' => null, 'valueDat' => null, 'isDefault' => true, 'language' => ISO639x1Enum::_DE, 'country' => ISO3166TwoEnum::_DEU, ], $this->value->jsonSerialize() ); } }