public function testFirstOneAndHalfInThreeYears()
 {
     $rightData = [14 * 3, 4 * 3, 10 * 3];
     $testedData = new Determinate($this->customOneAndHalfInTwoYearsFirstDay, $this->customOneAndHalfInTwoYearsCurrentDay, $this->customOneAndHalfInTwoYearsDataDays);
     $testedArray = [(int) round($testedData->getAllHolidays()), (int) round($testedData->getWeekendHolidays()), (int) round($testedData->getWorkDayHolidays())];
     $this->assertEquals($rightData, $testedArray);
 }
 public function actionIndex($username)
 {
     //phrasedisp
     //phrase
     //mondaysdisp
     //
     // @todo: sort post dates
     // @todo: draw 2 weeks, week, 2 days and so on for past post dates
     $userid = User::findByUsername($username)->id;
     if ($userid) {
         $vacationDates = new PastDates(Yii::$app->user->getId());
         $startDate = $vacationDates->getStartDate();
         $datePosts = $vacationDates->getDatePosts();
         if ($startDate) {
             // dont show data
             $posts = Posts::find()->where(['and', ['UserID' => $userid], ['PostType' => 2]])->all();
             $postids = [];
             foreach ($posts as $p) {
                 $postids[] = $p['PostID'];
             }
             $postdates = PostDates::find()->where(['PostID' => $postids])->all();
             $ps = [];
             foreach ($postdates as $postdate) {
                 $ps[] = $postdate['PostDate'];
             }
             $vacations = new Determinate($startDate, null, $ps);
             $allHolidays = $vacations->getAllHolidays();
             $weekendHolidays = $vacations->getWeekendHolidays();
             $workDayHolidays = $vacations->getWorkDayHolidays();
             $daysForTwoWeeks = $vacations->getDaysForVacations(14);
             $furureMondaysForTwoWeeks = $vacations->getFurureMondays(14);
             $furureWorkingHoursForTwoWeeks = $vacations->getFurureWorkingHours(14);
             $daysForWeek = $vacations->getDaysForVacations(7);
             $furureMondaysForWeek = $vacations->getFurureMondays(7);
             $furureWorkingHoursForWeek = $vacations->getFurureWorkingHours(7);
             $daysForDay = $vacations->getDaysForVacations(1);
             $furureMondaysForDay = $vacations->getFurureMondays(1);
             $furureWorkingHoursForDay = $vacations->getFurureWorkingHours(1);
             return $this->render('index', ['username' => $username, 'posts' => $postdates, 'postids' => $postids, 'allHolidays' => $allHolidays, 'weekendHolidays' => $weekendHolidays, 'workDayHolidays' => $workDayHolidays, 'daysForTwoWeeks' => $daysForTwoWeeks, 'furureMondaysForTwoWeeks' => $furureMondaysForTwoWeeks, 'furureWorkingHoursForTwoWeeks' => $furureWorkingHoursForTwoWeeks, 'daysForWeek' => $daysForWeek, 'furureMondaysForWeek' => $furureMondaysForWeek, 'furureWorkingHoursForWeek' => $furureWorkingHoursForWeek, 'daysForDay' => $daysForDay, 'furureMondaysForDay' => $furureMondaysForDay, 'furureWorkingHoursForDay' => $furureWorkingHoursForDay, 'startDate' => $startDate, 'datePosts' => $datePosts]);
         } else {
             $model = new Posts();
             return $this->render('set_start_date', ['username' => $username]);
         }
     }
 }