Beispiel #1
0
 public function set(Jam_Validated $model, $value, $is_changed)
 {
     if (!$is_changed) {
         return $this->upload_file($model)->filename($value);
     }
     if ($value instanceof Upload_File) {
         $upload_file = $value;
     } else {
         $upload_file = $model->{$this->name};
         if ($value === NULL) {
             $upload_file->filename('');
         } elseif ($value) {
             if (Upload_Source::valid($value)) {
                 $upload_file->source($value);
             }
             $upload_file->filename($value);
         }
     }
     return $upload_file->path($this->path($model));
 }
Beispiel #2
0
 /**
  * @dataProvider data_guess_type
  */
 public function test_guess_type($source, $expected_type)
 {
     $this->assertEquals($expected_type, Upload_Source::guess_type($source));
     $this->assertEquals($expected_type !== FALSE, Upload_Source::valid($source));
 }