jeudi 3 novembre 2016

Functional tests in symfony3, access to container after submitting a form

I'm writing functional tests for my Symfony3 application. I have a test which looks like this:

public function testList()
{
    $client = static::createClient();
    $client->getCookieJar()->set($this->cookie);

    $this->sender->method('isSuccessfull')->will($this->returnValue(true));

    $container = $client->getContainer();
    $container->set('app.service1', $this->object1);
    $container->set('app.service2', $this->object2);

    $crawler = $client->request('GET', '/list/1');
    $form = $crawler->selectButton('Save')->form();
    $client->submit($form);

}

Everything is good until submitting form. Kernel losing the setted container services while submitting a form. How can I these services into container also after submitting a form? Maybe there is other option to resolve my problem?

Aucun commentaire:

Enregistrer un commentaire