コード例 #1
0
 /**
  * @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());
 }
コード例 #2
0
 /**
  * @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());
 }
コード例 #3
0
 /**
  * {@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);
 }