示例#1
0
 public function testOneMonth()
 {
     $p = new Box_Period('1M');
     $this->assertEquals('M', $p->getUnit());
     $this->assertEquals(1, $p->getQty());
     $this->assertEquals('1M', $p->getCode());
     $this->assertEquals('Every 1 months', $p->getTitle());
     $this->assertEquals(30, $p->getDays());
     $this->assertEquals(1, $p->getMonths());
     $this->assertEquals(strtotime('+1 month'), $p->getExpirationTime());
 }
示例#2
0
 /**
  * @deprecated in order of Box_Period appear
  * @param Box_Period $period
  * @return string
  */
 private function _getPeriodKey(Box_Period $period)
 {
     $code = $period->getCode();
     switch ($code) {
         case '1W':
             return 'w';
         case '1M':
             return 'm';
         case '3M':
             return 'q';
         case '6M':
             return 'b';
         case '12M':
         case '1Y':
             return 'a';
         case '2Y':
             return 'bia';
         case '3Y':
             return 'tria';
         default:
             throw new Box_Exception('Unknown period selected ' . $code);
     }
 }