Ejemplo n.º 1
0
 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());
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }