public function testIsShortTerm() { $now = new \DateTime(); $this->lot->getInitial()->setDate($now->modify('-1 month')); $this->assertTrue($this->lot->isShortTerm()); $now = new \DateTime(); $this->lot->getInitial()->setDate($now->modify('-10 year -1 month')); $this->assertFalse($this->lot->isShortTerm()); $this->lot->setStatus(Lot::LOT_INITIAL); $now = new \DateTime(); $this->lot->setDate($now->modify('-1 month')); $this->assertTrue($this->lot->isShortTerm()); $now = new \DateTime(); $this->lot->setDate($now->modify('-1 year -1 month')); $this->assertFalse($this->lot->isShortTerm()); }
/** * Determine if the sale will cause short term gain * * @param obj Lot [instance of Lot] * @return bool [returns true if sale is a short-term gain] */ public function checkShortTermGain(Lot $lot) { if ($lot->getWasClosed()) { return false; } if (!$lot->isShortTerm()) { return false; } return true; }