示例#1
0
 /**
  *  Test the expiration_date_select() method
  *
  *  Test the {@link DateHelper::expiration_date_select()} method
  */
 public function testExpiration_date_select()
 {
     $dh = new DateHelper('License', 'expiration_date');
     $_REQUEST['License']['expiration_date(1i)'] = date('Y');
     $_REQUEST['License']['expiration_date(2i)'] = '08';
     //  Test expiration date of August this year
     $this->assertContains('<option value="' . date('Y') . '"  selected="selected"', $dh->expiration_date_select());
     $this->assertContains('<option value="' . (date('Y') + 7) . '"', $dh->expiration_date_select());
     $this->assertContains('<option value="08" selected="selected">' . '8</option>', $dh->expiration_date_select());
 }
示例#2
0
/**
 *  Make a new DateHelper object and call its expiration_date_select() method
 *  @param string Name of an ActiveRecord subclass
 *  @param string Name of an attribute of $object
 *  @param mixed[] Format options
 *  @uses DateHelper::expiration_date_select()
 */
function expiration_date_select($object, $attribute, $options = array())
{
    $date_helper = new DateHelper($object, $attribute);
    return $date_helper->expiration_date_select($options);
}