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();

    $test= serialize($unObject);

    $this->get('session')->set('maSession',  serialize($unObject));
    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.

People are also looking for solutions to the problem: php - hide price and add_cart for anonymous user in drupal


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.