This repository was archived by the owner on Sep 10, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -673,7 +673,7 @@ function folderCreate($args)
673673 $ modelLoader = new MIDAS_ModelLoader ();
674674 $ folderModel = $ modelLoader ->loadModel ('Folder ' );
675675 $ name = $ args ['name ' ];
676- $ description = $ args ['description ' ];
676+ $ description = isset ( $ args ['description ' ]) ? $ args [ ' description ' ] : '' ;
677677
678678 $ uuid = isset ($ args ['uuid ' ]) ? $ args ['uuid ' ] : '' ;
679679 $ record = false ;
@@ -720,7 +720,7 @@ function folderCreate($args)
720720 $ policyGroup = $ folder ->getFolderpolicygroup ();
721721 $ policyUser = $ folder ->getFolderpolicyuser ();
722722 $ folderpolicygroupModel = $ modelLoader ->loadModel ('Folderpolicygroup ' );
723- $ folderpolicyuserModel = $ modelLoader ->loadModel ('Folderpolicygroup ' );
723+ $ folderpolicyuserModel = $ modelLoader ->loadModel ('Folderpolicyuser ' );
724724 foreach ($ policyGroup as $ policy )
725725 {
726726 $ folderpolicygroupModel ->createPolicy ($ policy ->getGroup (), $ new_folder , $ policy ->getPolicy ());
Original file line number Diff line number Diff line change @@ -174,6 +174,27 @@ public function testCommunityList()
174174 //TODO test that a private community is not returned (requires another community in the data set)
175175 }
176176
177+ /** Test creating a folder */
178+ public function testFolderCreate ()
179+ {
180+ $ usersFile = $ this ->loadData ('User ' , 'default ' );
181+ $ userDao = $ this ->User ->load ($ usersFile [0 ]->getKey ());
182+
183+ $ this ->resetAll ();
184+ $ this ->params ['token ' ] = $ this ->_loginAsAdministrator ();
185+ $ this ->params ['method ' ] = 'midas.folder.create ' ;
186+ $ this ->params ['name ' ] = 'testFolderCreate ' ;
187+ $ this ->params ['parentid ' ] = $ userDao ->getPublicfolderId ();
188+ $ resp = $ this ->_callJsonApi ();
189+ $ this ->_assertStatusOk ($ resp );
190+
191+ // Make sure folder was created correctly
192+ $ this ->assertNotEmpty ($ resp ->data ->uuid );
193+ $ this ->assertEquals ($ userDao ->getPublicfolderId (), $ resp ->data ->parent_id );
194+ $ this ->assertEquals ('testFolderCreate ' , $ resp ->data ->name );
195+ $ this ->assertEquals ('' , $ resp ->data ->description );
196+ }
197+
177198 /** Test listing of child folders */
178199 public function testFolderChildren ()
179200 {
You can’t perform that action at this time.
0 commit comments