Esempio n. 1
0
 /**
  * Ensures that setFiles() returns expected value
  *
  * @return void
  */
 public function testSetFiles()
 {
     $files = array('test' => array('name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', 'error' => 0), 'test2' => array('name' => 'test2', 'type' => 'text2', 'size' => 202, 'tmp_name' => 'tmp_test2', 'error' => 1));
     $_FILES = array('test' => array('name' => 'test3', 'type' => 'text3', 'size' => 203, 'tmp_name' => 'tmp_test3', 'error' => 2));
     $validator = new File\Upload();
     $validator->setFiles(array());
     $this->assertEquals($_FILES, $validator->getFiles());
     $validator->setFiles();
     $this->assertEquals($_FILES, $validator->getFiles());
     $validator->setFiles($files);
     $this->assertEquals($files, $validator->getFiles());
 }
Esempio n. 2
0
 /**
  * @group ZF-11258
  */
 public function testZF11258()
 {
     $validator = new File\Upload();
     $this->assertFalse($validator->isValid(__DIR__ . '/_files/nofile.mo'));
     $this->assertTrue(array_key_exists('fileUploadErrorFileNotFound', $validator->getMessages()));
     $this->assertContains("nofile.mo'", current($validator->getMessages()));
 }
Esempio n. 3
0
 /**
  * @group ZF-12128
  */
 public function testErrorMessage()
 {
     $_FILES = array('foo' => array('name' => 'bar', 'type' => 'text', 'size' => 100, 'tmp_name' => 'tmp_bar', 'error' => 7));
     $validator = new File\Upload();
     $validator->isValid('foo');
     $this->assertEquals(array('fileUploadErrorCantWrite' => "File 'bar' can't be written"), $validator->getMessages());
 }