diff --git a/.env.testing b/.env.testing index 79768a66..e7363e0b 100644 --- a/.env.testing +++ b/.env.testing @@ -3,6 +3,7 @@ APP_ENV=testing APP_KEY=base64:47yorkyoH3qCrKKO4eG6LpZUogoTC51qey5vYq/O3AM= APP_DEBUG=true APP_URL=http://localhost +APP_DEMO=false LOG_CHANNEL=stack diff --git a/tests/Feature/Share/ShareEditorTest.php b/tests/Feature/Share/ShareEditorTest.php index 7b47c27f..ca5dcb71 100644 --- a/tests/Feature/Share/ShareEditorTest.php +++ b/tests/Feature/Share/ShareEditorTest.php @@ -66,6 +66,39 @@ class ShareEditorTest extends TestCase ]); } + /** + * @test + */ + public function it_create_new_folder_in_shared_folder() + { + $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', + ]); + + $this->postJson("/api/editor/create-folder/public/$share->token", [ + 'name' => 'Awesome New Folder', + 'parent_id' => $folder->id, + ]) + ->assertStatus(201) + ->assertJsonFragment([ + 'name' => 'Awesome New Folder', + ]); + + $this->assertDatabaseHas('folders', [ + 'name' => 'Awesome New Folder', + 'parent_id' => $folder->id, + 'user_scope' => 'editor', + ]); + } + /** * @test */