/** * Rechnet die Monate zurück */ protected function _createAheadMonths() { $looking_months = $this->getParameter('trolley_agenda.calendar.month_looking_ahead'); $dayname = $this->getParameter('trolley_agenda.calendar.every_day'); $MonthOverview = new MonthOverview(); $MonthOverview->createAheadMonth($looking_months); $MonthOverview->fillMonthWithDaysFor($dayname); $MonthOverview->mergeDaysWithDB(); return $MonthOverview; }
/** * Erstellt alle Tage in der DB wenn sie nicht vor handen sind * * @covers Trolley\AgendaBundle\Util\MonthOverview::mergeDaysWithDB */ public function testCreateDaysInDB() { global $kernel; $kernel = self::$kernel; //New 'Saturday' Days $expectMonthOverview = new MonthOverview(); $expectMonthOverview->createAheadMonth(1); $expectMonthOverview->fillMonthWithDaysFor(['Saturday']); $expectMonthOverview->mergeDaysWithDB(); //Add 'Monday' Days $expectMonthOverview = new MonthOverview(); $expectMonthOverview->createAheadMonth(1); $expectMonthOverview->fillMonthWithDaysFor(['Monday', 'Saturday']); $expectMonthOverview->mergeDaysWithDB(); $actualMonthOverview = new MonthOverview(); $actualMonthOverview->createAheadMonth(1); $actualMonthOverview->fillMonthWithDaysFor(['Monday', 'Saturday']); /** @var \Trolley\AgendaBundle\Repository\DayRepository $dayRepository */ $dayRepository = $this->getDoctrine()->getRepository('TrolleyAgendaBundle:Day'); $actual = $dayRepository->findDaysByMonth($actualMonthOverview); $this->dayInDBToDelete = $actual; $this->assertGreaterThan(0, count($actual)); $this->assertEquals($expectMonthOverview->getDaysList(), $actual); }