public function testFindNthDayOfMonth() { //Returns the right object $this->object = new Application_Model_ReoccurenceTemplate("2011-11-01"); $this->assertInstanceOf('DateTime', $this->object->findNthDayOfMonth(1)); //First day of Nov 2011 $this->object = new Application_Model_ReoccurenceTemplate("2011-11-01"); $this->assertEquals(1320192000, $this->object->findNthDayOfMonth(2)->getTimestamp()); //Last day of Nov 2011 $this->object = new Application_Model_ReoccurenceTemplate("2011-11-01"); $this->assertEquals(1322611200, $this->object->findNthDayOfMonth(-1)->getTimestamp()); }
/** * Monthly day pattern entries getter * * @param integer $year * @param integer $month * @return Application_Model_AppDateTime */ private function _getMonthlyDayPatternEntries($year, $month) { $rt = new Application_Model_ReoccurenceTemplate("{$year}-{$month}-01"); $rendered_date = $rt->findNthDayOfMonth($this->_monthly_day_pattern); if ($this->_monthly_exception_callback) { $callback = $this->_monthly_exception_callback; $rendered_date = $callback($rendered_date); } return $rendered_date; }