/**
  * Test that we can add fields to ProblemColumnDateRange object.
  *
  * @return void
  */
 public function testProblemColumnDateRangeAddRangeFields()
 {
     $low = Carbon::createFromFormat('Y-m-d H:i:s', $this->faker->dateTimeBetween('-3 years')->format('Y-m-d H:i:s'));
     $high = Carbon::createFromFormat('Y-m-d H:i:s', $this->faker->dateTimeBetween('now', '+3 years')->format('Y-m-d H:i:s'));
     $this->problemColumnDateRange->defineRange(['low' => $low, 'high' => $high]);
     $this->assertCount(2, $this->problemColumnDateRange);
     $this->assertEquals(['low' => $low->toIso8601String(), 'high' => $high->toIso8601String()], $this->problemColumnDateRange->all());
 }
Example #2
0
 /**
  * Set birthday.
  *
  * @param integer $years Years.
  */
 protected function setBirthday($years = 0)
 {
     $date = new \DateTime();
     $this->birthday = $years ? self::$faker->dateTimeBetween('-' . $years . ' years', (int) $date->format('Y') - $years + 1 . '-01-01')->format('Y-m-d') : self::$faker->date('Y-m-d', '2002-01-01');
 }