/** * Erstellt die Monate davor * * @param integer $count * * @return $this */ public function createBeforMonth($count) { for ($month_add = 1; $month_add <= $count; $month_add++) { $Month = new Month(); $Month->setMonth("-" . $month_add . ' month'); $this[$Month->getMonthName()] = $Month; } return $this; }
/** * Testet ob der Tag ersetzt werden kann. * Um das Entity aus der DB. */ public function testReplaceADay() { $month = new Month(); $month->setMonth('2016-10-01'); $month[] = new Day('2016-10-20'); $month[] = new Day('2016-10-21'); $month[] = new Day('2016-10-22'); $replace = new Day('2016-10-21'); $replace->isReplaced = true; $isReplaced = $month->replaceDay($replace); $this->assertTrue($isReplaced, 'is not replaces, but must be: ' . $replace); $this->assertEquals($month[1], $replace); $wrongMonth = new Day('2016-9-21'); $isNotReplaced = $month->replaceDay($wrongMonth); $this->assertFalse($isNotReplaced, 'Is replaced but must be not, through is not the same Month. ' . $wrongMonth); }
/** * 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()); }