namespace Symfony\Component\DomCrawler\Tests\Field;
use Symfony\Component\DomCrawler\Field\FileFormField;
class FileFormFieldTest extends FormFieldTestCase
{ public function testInitialize() { $node =
$this->
createNode('input', '',
['type' => 'file'
]);
$field =
new FileFormField($node);
$this->
assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => \UPLOAD_ERR_NO_FILE, 'size' => 0
],
$field->
getValue(), '->initialize() sets the value of the field to no file uploaded'
);
$node =
$this->
createNode('textarea', ''
);
try { new FileFormField($node);
$this->
fail('->initialize() throws a \LogicException if the node is not an input field'
);
} catch (\LogicException
$e) { $this->
assertTrue(true, '->initialize() throws a \LogicException if the node is not an input field'
);
}