Exemplo n.º 1
0
 public function testConstructor()
 {
     $attr = array('tmp_name' => self::$filename, 'name' => 'my-avatar.txt', 'type' => 'text/plain', 'size' => 8, 'error' => 0);
     $uploadedFile = new UploadedFile($attr['tmp_name'], $attr['name'], $attr['type'], $attr['size'], $attr['error'], false);
     $this->assertEquals($attr['name'], $uploadedFile->getClientFilename());
     $this->assertEquals($attr['type'], $uploadedFile->getClientMediaType());
     $this->assertEquals($attr['size'], $uploadedFile->getSize());
     $this->assertEquals($attr['error'], $uploadedFile->getError());
     $this->assertEquals('txt', $uploadedFile->getClientFileExt());
     $this->assertTrue($uploadedFile->validFileExt(array('txt')));
     $this->assertFalse($uploadedFile->validFileExt(array('jpg')));
     return $uploadedFile;
 }