Ejemplo n.º 1
0
 public function testSetRawFilePath()
 {
     $node = $this->createNode('input', '', array('type' => 'file'));
     $field = new FileFormField($node);
     $field->setFilePath(__FILE__);
     $this->assertEquals(__FILE__, $field->getValue());
 }
 public function testSetErrorCode()
 {
     $node = $this->createNode('input', '', array('type' => 'file'));
     $field = new FileFormField($node);
     $field->setErrorCode(UPLOAD_ERR_FORM_SIZE);
     $value = $field->getValue();
     $this->assertEquals(UPLOAD_ERR_FORM_SIZE, $value['error'], '->setErrorCode() sets the file input field error code');
     try {
         $field->setErrorCode('foobar');
         $this->fail('->setErrorCode() throws a \\InvalidArgumentException if the error code is not valid');
     } catch (\InvalidArgumentException $e) {
         $this->assertTrue(true, '->setErrorCode() throws a \\InvalidArgumentException if the error code is not valid');
     }
 }