Slide 25
Slide 25 text
public function user_should_be_able_to_publish_trip()
{
// **Given** I am logged in with user "john"
$this->login('john')
// **When** I publish a trip from Paris to Rennes in 2 days
$this->client->request($this->url('publication'));
$params = [
'from' => 'Paris',
'to' => 'Nantes',
'date' => new \DateTime('+2 days')
];
$this->form('publication')->fill($params)->submit();
// **Then** a trip from Paris to Rennes should be published
$this->response->OK();
$this->assertNotNull(
$this->tripRepository->findOneBy($params)
);
// **And** a trip.published event is dispatched
$this->event->dispatched('trip.published');
}