mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
added guest_search_file, guest_try_search_non_shared_user_file test
This commit is contained in:
@@ -57,7 +57,7 @@ class ShareContentAccessTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Get share record
|
// Get share record
|
||||||
$this->get("/api/files/$share->token/public")
|
$this->get("/api/browse/files/$share->token/public")
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertJsonFragment([
|
->assertJsonFragment([
|
||||||
'basename' => $document->name
|
'basename' => $document->name
|
||||||
@@ -85,7 +85,7 @@ class ShareContentAccessTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Get share record
|
// Get share record
|
||||||
$this->get("/api/files/$share->token/public")
|
$this->get("/api/browse/files/$share->token/public")
|
||||||
->assertStatus(403);
|
->assertStatus(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -685,4 +685,63 @@ class ShareEditorTest extends TestCase
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function guest_search_file()
|
||||||
|
{
|
||||||
|
$folder = Folder::factory(Folder::class)
|
||||||
|
->create();
|
||||||
|
|
||||||
|
$share = Share::factory(Share::class)
|
||||||
|
->create([
|
||||||
|
'item_id' => $folder->id,
|
||||||
|
'user_id' => $folder->user_id,
|
||||||
|
'type' => 'folder',
|
||||||
|
'is_protected' => false,
|
||||||
|
'permission' => 'editor',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$file = File::factory(File::class)
|
||||||
|
->create([
|
||||||
|
'name' => 'Document',
|
||||||
|
'folder_id' => $folder->id,
|
||||||
|
'user_id' => $folder->user_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->getJson("/api/browse/search/public/$share->token?query=doc")
|
||||||
|
->assertStatus(200)
|
||||||
|
->assertJsonFragment([
|
||||||
|
'id' => $file->id
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function guest_try_search_non_shared_user_file()
|
||||||
|
{
|
||||||
|
$folder = Folder::factory(Folder::class)
|
||||||
|
->create();
|
||||||
|
|
||||||
|
$share = Share::factory(Share::class)
|
||||||
|
->create([
|
||||||
|
'item_id' => $folder->id,
|
||||||
|
'user_id' => $folder->user_id,
|
||||||
|
'type' => 'folder',
|
||||||
|
'is_protected' => false,
|
||||||
|
'permission' => 'editor',
|
||||||
|
]);
|
||||||
|
|
||||||
|
File::factory(File::class)
|
||||||
|
->create([
|
||||||
|
'name' => 'Document',
|
||||||
|
'user_id' => $folder->user_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->getJson("/api/browse/search/public/$share->token?query=doc")
|
||||||
|
->assertStatus(200)
|
||||||
|
->assertJsonFragment([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ class ShareTest extends TestCase
|
|||||||
'is_protected' => 0,
|
'is_protected' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->get("/api/shared/$share->token")
|
$this->get("/api/browse/shared/$share->token")
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertExactJson([
|
->assertExactJson([
|
||||||
'data' => [
|
'data' => [
|
||||||
@@ -273,7 +273,7 @@ class ShareTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function it_get_deleted_shared_record()
|
public function it_get_deleted_shared_record()
|
||||||
{
|
{
|
||||||
$this->get("/api/shared/19ZMPNiass4ZqWwQ")
|
$this->get("/api/browse/shared/19ZMPNiass4ZqWwQ")
|
||||||
->assertNotFound();
|
->assertNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user