PhpUnit symfony2测试表输入文件

时间:2016-06-06 10:40:32

标签: php forms symfony testing phpunit

我想用phpUnit和Symfony在我的表单中测试一个上传文件。 这是我的表格:

public function buildForm(FormBuilderInterface $builder, array $options)
    {

        $builder
            ->add('fotoprofilo', null, array(
                    'label' => 'ProfilePhoto',
                    'required' => false,
                    'attr' => array('class' => 'upload-image'), )
            )
            ->add('ilmionome', 'text', array(
                    'label' => 'MyName',
                    'required' => false, )
            )

这是我的测试:

public function testRegistrationGadgetPuppy()
    {
        $client = $this->createLoggedClient();

        $crawler = $client->request('GET', '/reg_form');

        $button = $crawler->selectButton('Registra');

        $form = $button->form(array(
            'rf[fotoprofilo]' => ??
            'rf[ilmionome]' => 'Zelda',
        ));

        $client->submit($form);

        $crawler = $client->followRedirect();
    }

我不知道如何传递这些输入。你能救我吗?

0 个答案:

没有答案