public function testRenderShow() { $trip = new Trip('Praha (test)', 'Brno (test)'); $service = new TripService($this->entityManager); $service->save($trip); $presenter = new TripPresenter(); $request = new PresenterRequest('Trip', 'GET', array('action' => 'show', 'id' => $trip->id)); $response = $presenter->run($request); $this->assertType('Nette\\Application\\RenderResponse', $response); }
/** * locationsForm submit handler (trip saving). * @param Nette\Application\AppForm */ public function submitLocationsForm(AppForm $form) { $values = $form->values; $service = new TripService($this->entityManager); try { $trip = $service->buildTrip($values['from'], $values['to'], new TripCurlMapper()); $service->save($trip); $this->flashMessage('Trip successfully saved.'); $this->redirect('Trip:show', array('id' => $trip->id)); } catch (InvalidStateException $e) { $form->addError('Error occurred while getting directions. Please try again later.'); } }