diff --git a/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php b/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php new file mode 100644 index 000000000..c94238a51 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php @@ -0,0 +1,66 @@ +client = static::createClient(array(), array( + 'PHP_AUTH_USER' => 'center a_social', + 'PHP_AUTH_PW' => 'password', + )); + } + + private function getAccompanyingPeriodFromFixtures(): AccompanyingPeriod + { + $em = static::$kernel->getContainer() + ->get('doctrine.orm.entity_manager'); + + $accompanying_period = $em->getRepository('ChillPersonBundle:AccompanyingPeriod')->find(1); + + if ($accompanying_period === NULL) { + throw new \RuntimeException("We need an accompanying course with id = 1. Did you add fixtures ?"); + } + + return $accompanying_period; + } + + public function testList() + { + $this->client->request( + Request::METHOD_GET, + sprintf('/fr/calendar/?accompanying_period_id=%d', $this->getAccompanyingPeriodFromFixtures()->getId()) + ); + + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + } + + + public function testNew() + { + $this->client->request( + Request::METHOD_GET, + sprintf('/fr/calendar/new?accompanying_period_id=%d', $this->getAccompanyingPeriodFromFixtures()->getId()) + ); + + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + } + +}