File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,30 @@ public function testFailSaveFilePath()
126126 $ this ->assertEmpty ($ model ->image_path );
127127 }
128128
129+ public function testReUpload ()
130+ {
131+ list ($ file , $ model ) = $ this ->uploadFileAndBindToModel ([
132+ 'modelName ' => News::className (),
133+ 'attribute ' => 'image_path ' ,
134+ 'inputName ' => 'file-300 ' ,
135+ 'temporary ' => true
136+ ]);
137+
138+ $ response = $ this ->runUploadAction ([
139+ 'modelName ' => News::className (),
140+ 'attribute ' => 'image_path ' ,
141+ 'inputName ' => 'file-500 ' ,
142+ 'temporary ' => true ,
143+ ]);
144+
145+ $ model ->image_path = $ response ['id ' ];
146+ $ model ->save ();
147+
148+ $ file = File::findOne ($ response ['id ' ]);
149+ $ file ->setStorage ($ this ->storage );
150+ $ this ->assertTrue ($ model ->image_path === $ file ->getStorage ()->path ());
151+ }
152+
129153 public function testDeleteFile ()
130154 {
131155 list ($ file , $ model ) = $ this ->uploadFileAndBindToModel ([
You can’t perform that action at this time.
0 commit comments