KahlanBundle

RequestHelper :

Should you ever need a Request object to give to some particular function, you can ask RequestHelper service. Simply call it via the shortcut $this->getRequest() in your spec files.

Method signature :

<?php
public function getRequest($method = null, $url = null, array $parameters = array());

/!\ The second parameter, $url, is used with a route, relative to your website root. Simply pass the path part of your routing.

Example :


<?php
[...] // Inside a spec function...
// Blank Request object
$request = $this->getRequest();

// Request object filled without parameters
$request = $this->getRequest('get', '/entity/tag/1');

// Request object with parameters, say for testing form
$request = $this->getRequest('post', '/save/entity', array('entity' => $entity));