Loading htdocs/testing/classes/generator/TestingDataGenerator.php +54 −1 Original line number Diff line number Diff line Loading @@ -1464,7 +1464,7 @@ EOD; * Currently it only supports adding title / description, * | title | ownertype | ownername | description | pages | * | collection one | user | UserA | desc of col |Page One,Page Two | * @param array $record * @param unknown $record * @throws SystemException if creating failed * @return int new collection id */ Loading Loading @@ -1640,6 +1640,59 @@ EOD; $artefact->commit(); } /** * A fixture to set up forums in bulk. * Currently it doesn't support indenting and other additional settings * * And the following "forums" exist: * | group | title | description | creator | * | Group1 | unicorns! | magic mahara unicorns| UserB | * * @param unknown $record * @throws SystemException */ public function create_forum($record) { $record['title'] = trim($record['title']); $record['description'] = trim($record['description']); $record['creator'] = trim($record['creator']); $record['group'] = trim($record['group']); $groupid; $creatorid; $isadmin; // check that the group exists if (!$groupid = get_field('group', 'id', 'name',$record['group'] )) { throw new SystemException("Invalid group '" . $record['group'] . "'"); } //check the creator exists as a user if (!$creatorid = get_field('usr','id', 'username', $record['creator'])) { throw new SystemException("The user " . $record['creator'] . " doesn't exist"); } //check that the creator is an admin of the group (for permission to create forum) if (!$isadmin = get_field('group_member', 'member', 'group', $groupid, 'role', "admin", 'member', $creatorid)) { throw new SystemException("The " . $record['creator'] . " does not have admin rights in group " . $record['group'] . "to create a forum"); } $forum = new InteractionForumInstance(0, (object) array( 'group' => $groupid, 'creator' => $creatorid, 'title' => $record['title'], 'description' => $record['description'] )); $forum->commit(); // configure other settings PluginInteractionForum::instance_config_save($forum, array( 'createtopicusers' => 'members', 'autosubscribe' => 1, 'justcreated' => 1, )); } /** * A fixture to set up messages in bulk. * Currently it only supports setting friend request / accept internal notifications Loading htdocs/testing/frameworks/behat/classes/BehatDataGenerators.php +10 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,16 @@ class BehatDataGenerators extends BehatBase { ), 'required' => array('owner', 'ownertype', 'plan', 'title', 'completiondate') ), 'forums' => array( 'datagenerator' => 'forum', 'available' => array( 'title' => 'text', 'description' => 'text', 'group' => 'text', 'creator' => 'text' ), 'required' => array('title','description','group','creator') ) ); /** Loading test/behat/features/user_content/test.feature +15 −13 Original line number Diff line number Diff line Loading @@ -15,6 +15,10 @@ Background: | name | owner | description | grouptype | open | invitefriends | editroles | submittableto | allowarchives | members | staff | | Group1 | UserB | Group1 owned by UserB | standard | ON | OFF | all | ON | OFF | UserA | | And the following "forums" exist: | group | title | description | creator | | Group1 | unicorns! | magic mahara unicorns| UserB | And the following "pages" exist: | title | description | ownertype | ownername | | Page UserA_00 | Page 01 | user | UserA | Loading Loading @@ -93,10 +97,7 @@ Background: | my pdf | pdf | Page Three | no | attachment=mahara_about.pdf | | g rcnt posts| recentforumposts| Page Three | no | groupname=Group1; maxposts=-1 | Scenario: Create Page UserA_00 with text blocks Scenario: Login as admin to change upload settings # To allow users to upload specific internal media types Given I log in as "admin" with password "Kupuh1pa!" And I go to "/admin/extensions/pluginconfig.php?plugintype=blocktype&pluginname=file/internalmedia" Loading @@ -116,7 +117,8 @@ Scenario: Create Page UserA_00 with text blocks And I press "Save" Then I log out Then I log in as "UserA" with password "Kupuh1pa!" Scenario: Create Page with Blocks Given I log in as "UserA" with password "Kupuh1pa!" And I go to portfolio page "Page UserA_00" And I go to portfolio page "Page Grp1" And I go to portfolio page "Page UserB_00" Loading Loading
htdocs/testing/classes/generator/TestingDataGenerator.php +54 −1 Original line number Diff line number Diff line Loading @@ -1464,7 +1464,7 @@ EOD; * Currently it only supports adding title / description, * | title | ownertype | ownername | description | pages | * | collection one | user | UserA | desc of col |Page One,Page Two | * @param array $record * @param unknown $record * @throws SystemException if creating failed * @return int new collection id */ Loading Loading @@ -1640,6 +1640,59 @@ EOD; $artefact->commit(); } /** * A fixture to set up forums in bulk. * Currently it doesn't support indenting and other additional settings * * And the following "forums" exist: * | group | title | description | creator | * | Group1 | unicorns! | magic mahara unicorns| UserB | * * @param unknown $record * @throws SystemException */ public function create_forum($record) { $record['title'] = trim($record['title']); $record['description'] = trim($record['description']); $record['creator'] = trim($record['creator']); $record['group'] = trim($record['group']); $groupid; $creatorid; $isadmin; // check that the group exists if (!$groupid = get_field('group', 'id', 'name',$record['group'] )) { throw new SystemException("Invalid group '" . $record['group'] . "'"); } //check the creator exists as a user if (!$creatorid = get_field('usr','id', 'username', $record['creator'])) { throw new SystemException("The user " . $record['creator'] . " doesn't exist"); } //check that the creator is an admin of the group (for permission to create forum) if (!$isadmin = get_field('group_member', 'member', 'group', $groupid, 'role', "admin", 'member', $creatorid)) { throw new SystemException("The " . $record['creator'] . " does not have admin rights in group " . $record['group'] . "to create a forum"); } $forum = new InteractionForumInstance(0, (object) array( 'group' => $groupid, 'creator' => $creatorid, 'title' => $record['title'], 'description' => $record['description'] )); $forum->commit(); // configure other settings PluginInteractionForum::instance_config_save($forum, array( 'createtopicusers' => 'members', 'autosubscribe' => 1, 'justcreated' => 1, )); } /** * A fixture to set up messages in bulk. * Currently it only supports setting friend request / accept internal notifications Loading
htdocs/testing/frameworks/behat/classes/BehatDataGenerators.php +10 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,16 @@ class BehatDataGenerators extends BehatBase { ), 'required' => array('owner', 'ownertype', 'plan', 'title', 'completiondate') ), 'forums' => array( 'datagenerator' => 'forum', 'available' => array( 'title' => 'text', 'description' => 'text', 'group' => 'text', 'creator' => 'text' ), 'required' => array('title','description','group','creator') ) ); /** Loading
test/behat/features/user_content/test.feature +15 −13 Original line number Diff line number Diff line Loading @@ -15,6 +15,10 @@ Background: | name | owner | description | grouptype | open | invitefriends | editroles | submittableto | allowarchives | members | staff | | Group1 | UserB | Group1 owned by UserB | standard | ON | OFF | all | ON | OFF | UserA | | And the following "forums" exist: | group | title | description | creator | | Group1 | unicorns! | magic mahara unicorns| UserB | And the following "pages" exist: | title | description | ownertype | ownername | | Page UserA_00 | Page 01 | user | UserA | Loading Loading @@ -93,10 +97,7 @@ Background: | my pdf | pdf | Page Three | no | attachment=mahara_about.pdf | | g rcnt posts| recentforumposts| Page Three | no | groupname=Group1; maxposts=-1 | Scenario: Create Page UserA_00 with text blocks Scenario: Login as admin to change upload settings # To allow users to upload specific internal media types Given I log in as "admin" with password "Kupuh1pa!" And I go to "/admin/extensions/pluginconfig.php?plugintype=blocktype&pluginname=file/internalmedia" Loading @@ -116,7 +117,8 @@ Scenario: Create Page UserA_00 with text blocks And I press "Save" Then I log out Then I log in as "UserA" with password "Kupuh1pa!" Scenario: Create Page with Blocks Given I log in as "UserA" with password "Kupuh1pa!" And I go to portfolio page "Page UserA_00" And I go to portfolio page "Page Grp1" And I go to portfolio page "Page UserB_00" Loading