Exemplo n.º 1
0
 /**
  * getFirstOfMonth provider
  *
  * @author Tom Haskins-Vaughan <*****@*****.**>
  * @since  1.0.0
  *
  * @return array
  */
 public static function getFirstOfMonthProvider()
 {
     return [[MonthYear::fromMonthAndYear(2, 2016), '2016-02-01'], [MonthYear::fromMonthAndYear(12, 2016), '2016-12-01'], [MonthYear::fromDateTime(new DateTime('2015-10-04')), '2015-10-01']];
 }
Exemplo n.º 2
0
 /**
  * Whether this MonthYear is greater than the given one
  *
  * @author Tom Haskins-Vaughan <*****@*****.**>
  * @since  1.0.0
  *
  * @param MonthYear $monthYear
  *
  * @return bool
  */
 public function greaterThan(MonthYear $other)
 {
     return $this->getYear() > $other->getYear() || $this->getYear() == $other->getYear() && $this->getMonth() > $other->getMonth();
 }
Exemplo n.º 3
0
 /**
  * Test greaterThan()
  *
  * @author Tom Haskins-Vaughan <*****@*****.**>
  * @since  1.0.0
  *
  * @dataProvider greaterThanProvider
  */
 public function testGreaterThan($month, $year, $otherMonth, $otherYear, $greaterThanOther)
 {
     $monthYear = MonthYear::fromMonthAndYear($month, $year);
     $otherMonthYear = MonthYear::fromMonthAndYear($otherMonth, $otherYear);
     $this->assertSame($greaterThanOther, $monthYear->greaterThan($otherMonthYear));
 }