Ejemplo n.º 1
0
 /**
  * @expectedException \Celest\DateTimeException
  */
 public function test_minus_TemporalAmount_invalidTooSmall()
 {
     $period = MockSimplePeriod::of(1, CU::YEARS());
     LocalDateTime::of(Year::MIN_VALUE, 1, 1, 0, 0)->minusAmount($period);
 }
Ejemplo n.º 2
0
 public function test_minus_TemporalAmount_Period_zero()
 {
     $z = $this->TEST_DATE_TIME->minusAmount(MockSimplePeriod::ZERO_DAYS());
     $this->assertEquals($z, $this->TEST_DATE_TIME);
 }
 public function test_minus_Period()
 {
     $period = MockSimplePeriod::of(7, CU::MONTHS());
     $t = self::TEST_2008_6_30_11_30_59_000000500()->minusAmount($period);
     $this->assertEquals($t, OffsetDateTime::of(2007, 11, 30, 11, 30, 59, 500, self::OFFSET_PONE()));
 }
Ejemplo n.º 4
0
 public function compareTo(MockSimplePeriod $otherPeriod)
 {
     if ($this->unit->equals($otherPeriod->getUnit()) == false) {
         throw new IllegalArgumentException("Units cannot be compared: " . $this->unit . " and " . $otherPeriod->getUnit());
     }
     return Long::compare($this->amount, $otherPeriod->amount);
 }
Ejemplo n.º 5
0
 /**
  * @expectedException \Celest\DateTimeException
  */
 public function test_minus_TemporalAmount_dateNotAllowed()
 {
     $period = MockSimplePeriod::of(7, CU::MONTHS());
     self::TEST_123040987654321()->minusAmount($period);
 }
Ejemplo n.º 6
0
 public function test_minus_MinusAdjuster_noChange()
 {
     $t = self::TEST_11_30_59_500_PONE()->minusAmount(MockSimplePeriod::of(0, CU::SECONDS()));
     $this->assertEquals($t, self::TEST_11_30_59_500_PONE());
 }
Ejemplo n.º 7
0
 function data_badPlusTemporalAmount()
 {
     return [[MockSimplePeriod::of(2, CU::YEARS())], [MockSimplePeriod::of(2, CU::MONTHS())]];
 }