php - Symfony test serialize
This is my test file
$crawler = $this->client->request('GET', $this->getUrlOfRoute($this->routeStep1));
$buttonCrawlerNode = $crawler->selectButton('next_step');
$form = $buttonCrawlerNode->form(array(
'form[name]' => '__davidc',
), 'POST');
$crawler = $this->client->submit($form);
$container = $this->client->getContainer();
$session = $container->get('session')->get('maSession');
This is my controller :
if (!$form->getData()['name']) {
return $this->redirect($this->generateUrl('error_page'));
}
$data = $form->getData();
$name = $data['name'];
$unObject = new ObjectPerso();
$unObject->setName($name);
$test= serialize($unObject);
$this->get('session')->set('maSession', serialize($unObject));
var_dump($this->get('session')->get('maSession'));
return $this->redirect($this->generateUrl('step2'));
My problem is that when I execute the test, it does not pass the serialize. This will return no error or exception but valid test.
Now I want to check the form and the session and I can not because it does not serialize and therefore nothing is not my session variable.