/** * @test */ public function it_should_be_able_to_change_description() { $listing = new Listing($this->channel, "News", new \DateTime("2015-11-28 18:00")); $this->assertEquals(null, $listing->getDescription()); $listing->setDescription("Listing details are here"); $this->assertEquals("Listing details are here", $listing->getDescription()); }
$app->group('/admin/channels/{slug}', function () { $this->get('', function ($request, $response, $args) { $parsedBody = $request->getParsedBody(); $channel = $this->get('tvlistings.channel.repository')->findOneBySlug($args['slug']); $listings = $this->get('tvlistings.listing.repository')->findBy($channel); $this->view->render($response, 'admin/show.html.twig', array('channel' => $channel, 'listings' => $listings)); return $response; })->setName('admin_channel_show'); $this->map(['GET', 'POST'], '/listings/new', function ($request, $response, $args) { $channel = $this->get('tvlistings.channel.repository')->findOneBySlug($args['slug']); if ($request->isPost()) { $parsedBody = $request->getParsedBody(); $listingRepository = $this->get('tvlistings.listing.repository'); $listing = new Listing($channel, $parsedBody['title'], new \DateTime($parsedBody['programDate'])); $listing->programAt($parsedBody['programAt']); $listing->setDescription($parsedBody['description']); $listingRepository->persist($listing); if ($parsedBody['video_source']) { $videoProxyService = $this->get('tvlistings.video_proxy.service'); $videoProxyUuid = $videoProxyService->createFromSource($parsedBody['video_source']); $listing->changeResourceLink($videoProxyUuid); $listingRepository->persist($listing); } $uri = $this->router->pathFor('admin_channel_show', array('slug' => $channel->getSlug())); return $response->withRedirect((string) $uri, 301); } $this->view->render($response, 'admin/Listing/new.html.twig', array('channel' => $channel)); return $response; })->setName('admin_listing_new'); $this->map(['GET', 'POST'], '/edit', function ($request, $response, $args) { $channelRepository = $this->get('tvlistings.channel.repository');