コード例 #1
0
 /**
  * Additional factory method that creates a new instance from
  * the passed schedule expression.
  *
  * @param \AppserverIo\Psr\EnterpriseBeans\ScheduleExpression $scheduleExpression The schedule expression with the data to create the instance with
  *
  * @return \AppserverIo\Appserver\PersistenceContainer\CalendarBasedTimeout The instance
  */
 public static function factoryFromScheduleExpression(ScheduleExpression $scheduleExpression)
 {
     // prepare the CRON expression
     $cronExpression = sprintf('%s %s %s %s %s %s %s', $scheduleExpression->getSecond(), $scheduleExpression->getMinute(), $scheduleExpression->getHour(), $scheduleExpression->getDayOfMonth(), $scheduleExpression->getMonth(), $scheduleExpression->getDayOfWeek(), $scheduleExpression->getYear());
     // return the point in time at which the next timer expiration is scheduled to occur
     return new CalendarBasedTimeout($cronExpression, $scheduleExpression, new FieldFactory());
 }
コード例 #2
0
 /**
  * Test the getMonth() method.
  *
  * @return void
  */
 public function testGetMonth()
 {
     $this->scheduleExpression->month($month = 10);
     $this->assertEquals($month, $this->scheduleExpression->getMonth());
 }