我想用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();
}
我不知道如何传递这些输入。你能救我吗?