コード例 #1
0
ファイル: MonthTest.php プロジェクト: TumTum/TrolleyAgenda
 /**
  * Testet ob der Month sich richtig füllt mit den Wochen
  *
  * @dataProvider ListOfWeeks
  */
 public function testFillDay($week)
 {
     $monthyear = date_create()->format('F Y');
     $month_start = date_create("first {$week} of {$monthyear}");
     $month_end = date_create("last {$week} of {$monthyear}");
     $plus7days = 604800;
     // 86400 * 7
     $days = [];
     for ($i = $month_start->format('U'); $i <= $month_end->format('U'); $i += $plus7days) {
         $days[] = date('l d-m-y', $i);
     }
     $days[] = date('l d-m-y', $month_end->format('U'));
     $month = new Month();
     $month->setMonth('this Month');
     $month->fillDaysOfWeek($week);
     foreach ($month as $date) {
         $this->assertEquals($week, $date->getTaDay()->format("l"));
         $this->assertContains($date->getTaDay()->format("l d-m-y"), $days);
     }
 }
コード例 #2
0
 /**
  * Testet ob MonthOverview alle Tage hat
  */
 public function testDayListe()
 {
     $monthOverview = new MonthOverview();
     $monthOverview->createAheadMonth(2);
     $exceptCount = 0;
     $Month = new Month();
     $Month->setMonth("now");
     $Month->fillDaysOfWeek('Saturday');
     $exceptCount += count($Month);
     $Month = new Month();
     $Month->setMonth("next Month");
     $Month->fillDaysOfWeek('Saturday');
     $exceptCount += count($Month);
     $monthOverview->fillMonthWithDaysFor(['Saturday']);
     $this->assertCount($exceptCount, $monthOverview->getDaysList());
 }