1. Kazusuke sasezaki
  2. MIRROR-zf1-standard-trunk-tests-Validate-dir

Commits

adamlundrigan  committed 0080e1e

ZF-12128: File Upload validator should display file name instead of field name in error message

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk/tests/Zend/Validate@2495944c647ce-9c0f-0410-b52a-842ac1e357ba

  • Participants
  • Parent commits 9854777
  • Branches master

Comments (0)

Files changed (1)

File File/UploadTest.php

View file
  • Ignore whitespace
         $this->assertEquals(array(), $validator->getFiles());
     }
 
+    /**
+     * @group ZF-12128
+     */
+    public function testErrorMessage()
+    {
+        $_FILES = array(
+            'foo' => array(
+                'name'     => 'bar',
+                'type'     => 'text',
+                'size'     => 100,
+                'tmp_name' => 'tmp_bar',
+                'error'    => 7,
+            )
+        );
+
+        $validator = new Zend_Validate_File_Upload();
+        $validator->isValid('foo');
+
+        $this->assertEquals(
+            array(
+                 'fileUploadErrorCantWrite' => "File 'bar' can't be written",
+            ),
+            $validator->getMessages()
+        );
+    }
+
 }
 
 // Call Zend_Validate_File_UploadTest::main() if this source file is executed directly.