/** * @Route("/api/dojo/{id}/events", name="api_dojo_events") * @ParamConverter("dojo", class="CoderDojoWebsiteBundle:Dojo") */ public function dojoEventAction(User $dojo) { $events = $dojo->getDojos(); $serializer = \JMS\Serializer\SerializerBuilder::create()->build(); $jsonContent = $serializer->serialize($events, 'json'); return new Response($jsonContent, 200, ['Access-Control-Allow-Origin' => '*']); }
/** * @test */ public function it_should_return_constructor_data() { $event1 = $this->createDojoEventMock(); $event2 = $this->createDojoEventMock(); $this->dojo->addDojo($event1); $this->dojo->addDojo($event2); $this->assertSame('chris', $this->dojo->getName()); $this->assertSame('street', $this->dojo->getStreet()); $this->assertSame('10', $this->dojo->getHousenumber()); $this->assertSame('1234aa', $this->dojo->getPostalcode()); $this->assertSame('city', $this->dojo->getCity()); $this->assertSame('facebook', $this->dojo->getFacebook()); $this->assertSame('twitter', $this->dojo->getTwitter()); $this->assertSame('website', $this->dojo->getWebsite()); $this->assertSame('location', $this->dojo->getLocation()); $this->assertSame('organiser', $this->dojo->getOrganiser()); $this->assertCount(2, $this->dojo->getDojos()); $this->dojo->removeDojo($event1); $this->assertCount(1, $this->dojo->getDojos()); }