mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
Merge remote-tracking branch 'origin/folders_upload' into folder_upload_v2
# Conflicts: # composer.lock # config/language-translations.php # public/mix-manifest.json # resources/js/components/FilesView/DesktopToolbar.vue # resources/js/helpers.js # resources/js/store/modules/fileFunctions.js # src/Domain/Files/Actions/UploadFileAction.php # src/Domain/Files/Requests/UploadRequest.php # tests/Domain/Admin/AdminTest.php # tests/Domain/Files/FileTest.php # tests/Domain/Folders/FolderTest.php # tests/Domain/Sharing/VisitorManipulatingTest.php # tests/Domain/Traffic/TrafficTest.php # tests/Domain/Trash/TrashTest.php # tests/Domain/Zip/UserZippingTest.php
This commit is contained in:
@@ -304,6 +304,7 @@ class AdminTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
});
|
||||
|
||||
@@ -43,6 +43,7 @@ class FileTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
|
||||
@@ -84,6 +85,7 @@ class FileTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
|
||||
@@ -128,6 +130,7 @@ class FileTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(401);
|
||||
|
||||
@@ -158,6 +161,7 @@ class FileTest extends TestCase
|
||||
->postJson('/api/upload', [
|
||||
'file' => $file,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(422);
|
||||
|
||||
@@ -292,6 +296,7 @@ class FileTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
});
|
||||
|
||||
@@ -374,6 +374,7 @@ class FolderTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => $folder->id,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
});
|
||||
@@ -412,4 +413,58 @@ class FolderTest extends TestCase
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_upload_folders_structure_with_files()
|
||||
{
|
||||
$file_1 = UploadedFile::fake()
|
||||
->create('fake-file_1.pdf', 12000000, 'application/pdf');
|
||||
|
||||
$file_2 = UploadedFile::fake()
|
||||
->create('fake-file_2.pdf', 12000000, 'application/pdf');
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
$uploaded_file_1 = $this
|
||||
->actingAs($user)
|
||||
->postJson('/api/upload', [
|
||||
'filename' => $file_2->name,
|
||||
'file' => $file_2,
|
||||
'path' => '/Folder_1/' . $file_2->name,
|
||||
'folder_id' => null,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
|
||||
$uploaded_file_2 = $this
|
||||
->actingAs($user)
|
||||
->postJson('/api/upload', [
|
||||
'filename' => $file_1->name,
|
||||
'file' => $file_1,
|
||||
'path' => '/Folder_1/Folder_2/' . $file_1->name,
|
||||
'folder_id' => null,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
|
||||
|
||||
$file_1_parent = Folder::whereName('Folder_1')->first();
|
||||
|
||||
$file_2_parent = Folder::whereName('Folder_2')->first();
|
||||
|
||||
$this->assertDatabaseHas('folders', [
|
||||
'id' => $uploaded_file_1['folder_id'],
|
||||
'parent_id' => null,
|
||||
'id' => $uploaded_file_2['folder_id'],
|
||||
'parent_id' => $file_1_parent->id,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('files', [
|
||||
'id' => $uploaded_file_1['id'],
|
||||
'folder_id' => $file_1_parent->id,
|
||||
'id' => $uploaded_file_2['id'],
|
||||
'folder_id' => $file_2_parent->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,6 +333,7 @@ class VisitorManipulatingTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => $folder->id,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
}
|
||||
@@ -343,6 +344,7 @@ class VisitorManipulatingTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => $folder->id,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ class TrafficTest extends TestCase
|
||||
'filename' => $this->file->name,
|
||||
'file' => $this->file,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $this->file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
|
||||
@@ -60,6 +61,7 @@ class TrafficTest extends TestCase
|
||||
'filename' => $this->file->name,
|
||||
'file' => $this->file,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $this->file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
|
||||
@@ -80,6 +82,7 @@ class TrafficTest extends TestCase
|
||||
'filename' => $secondFile->name,
|
||||
'file' => $secondFile,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $secondFile->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
|
||||
@@ -117,6 +120,7 @@ class TrafficTest extends TestCase
|
||||
'filename' => $this->file->name,
|
||||
'file' => $this->file,
|
||||
'parent_id' => $folder->id,
|
||||
'path' => '/' . $this->file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ class TrashTest extends TestCase
|
||||
'filename' => $image->name,
|
||||
'file' => $image,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $image->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ class UserZippingTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => $folder->id,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
});
|
||||
@@ -48,6 +49,7 @@ class UserZippingTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => null,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
});
|
||||
@@ -88,6 +90,7 @@ class UserZippingTest extends TestCase
|
||||
'filename' => $file->name,
|
||||
'file' => $file,
|
||||
'parent_id' => $folder->id,
|
||||
'path' => '/' . $file->name,
|
||||
'is_last' => 'true',
|
||||
])->assertStatus(201);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user