jeudi 31 mai 2018

start to testing sonata admin bundle?

Im finding for test sonta forms. but i not have ide. i execute the comand

./vendor/bin/phpunit --debug tests/AppBundle/Controller/ManualTest.php 

I habe 2 problems:

  1. I can't obtain the errors of the form
  2. I can't add child forms in the form

My test is like this:

    /** @var string $uniqid */
$form = $crawler->selectButton('Crear y editar')->form(array(
));
parse_str(parse_url($form->getFormNode()->getAttribute('action'))['query']);
$form["{$uniqid}[fechaEmision]"]->setValue('31/05/2018');
$crawler = $this->client->submit($form);
$this->assertEquals(0, $crawler->filter('.error_list')->count());

I want to learn to make better tests.

Aucun commentaire:

Enregistrer un commentaire