/** * Represents this instance as a string * @return string */ public function __toString() { $yearType = $this->type == YearType::Besselian() ? 'B' : 'J'; $epoch = ''; if (intval($this->year) == $this->year) { $epoch = "{$yearType}{$this->year}.0"; } else { if (false) { $epoch = "{$yearType}{$this->year}"; } else { $epoch = $this->toDate()->toTT()->format(AstroDate::FORMAT_EPOCH); } } //return "Epoch $epoch"; return $epoch; }
/** * @covers Marando\AstroDate\YearType::Besselian */ public function testBesselian() { $this->assertEquals(365.242198781, YearType::Besselian()->days, '', 1.0E-9); }
/** * @covers Marando\AstroDate\Epoch::B1950 */ public function testB1950() { $epoch = Epoch::B1950(); $this->assertEquals(1950, $epoch->year); $this->assertEquals(YearType::Besselian(), $epoch->type); $this->assertEquals(2433282.4235, $epoch->jd, 'jd', 0.0001); }