/** * @covers ::setUsages * @covers ::getUsages */ function testGetUsage() { $usage = new Usage(); $usage->setStart('1813-01-01')->setEnd(date('o') + 1 . '-02-28'); $this->assertSame($this->sut, $this->sut->setUsages([$usage])); $this->assertSame([$usage], $this->sut->getUsages()); }
/** * @covers ::setStart * @covers ::getStart */ public function testGetStart() { $start = 'foo' . mt_rand(); $this->assertSame($this->sut, $this->sut->setStart($start)); $this->assertSame($start, $this->sut->getStart()); }
/** * {@inheritdoc} */ public function __construct(array $values, $entity_type) { if (isset($values['usages'])) { $usages_data = $values['usages']; $values['usages'] = []; foreach ($usages_data as $usage_data) { $usage = new Usage(); $usage->setStart($usage_data['start'])->setEnd($usage_data['end'])->setCountryCode($usage_data['countryCode']); $values['usages'][] = $usage; } } parent::__construct($values, $entity_type); }