function testThisMonthNameShort() { $Textual = new Calendar_Decorator_Textual($this->mockcal); $this->assertEqual('Oct', $Textual->thisMonthName('short')); }
/** * Computes the data nececssary for the welcome screen. Automatically put into the request * data array. * * @access private */ function _compute_welcome_data() { setlocale(LC_ALL, 'fi_FI@UTF-8'); // First step of request data: Overall info $year_data = array(); $first_month = $this->_compute_first_month(); $last_month = $this->_compute_last_month(); $this->_request_data['first_month'] =& $first_month; $this->_request_data['last_month'] =& $last_month; $this->_request_data['total_count'] = $this->_compute_events_count_total(); $this->_request_data['year_data'] =& $year_data; if (!$first_month) { return; } // Second step of request data: Years and months. $first_year = $first_month->thisYear(); $last_year = $last_month->thisYear(); for ($year_nr = $first_year; $year_nr <= $last_year; $year_nr++) { $year = new Calendar_Year($year_nr); $year->build(); $year_url = $this->_get_calendar_yearlink($year); $year_count = $this->_compute_events_count_between($year->thisYear('timestamp'), $year->nextYear('timestamp')); $month_data = array(); // Loop over the months, start month is either first posting month // or January in all other cases. $month = null; if ($year_nr == $first_year) { for ($i = 1; $i < $first_month->thisMonth(); $i++) { $month = $year->fetch(); } } while ($month = $year->fetch()) { $month_textual = new Calendar_Decorator_Textual($month); $month_url = $this->_get_calendar_monthlink($month); $month_count = $this->_compute_events_count_between($month->thisMonth('timestamp'), $month->nextMonth('timestamp')); $month_data[$month->thisMonth()] = array('month' => $month_textual, 'name' => $month_textual->thisMonthName(), 'url' => $month_url, 'count' => $month_count); // Check for end month in end year if ($year_nr == $last_year && $month->thisMonth() >= $last_month->thisMonth()) { break; } } $year_data[$year_nr] = array('year' => $year_nr, 'url' => $year_url, 'count' => $year_count, 'month_data' => $month_data); } }