Commit 29a4af9b authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review

Merge changes from topic 'WR 304034'

* changes:
  Bug 1810990: blocktype: externalfeed -  count field     - additional: indentation changes, documentation, function simplificatoins
  Bug 1810990: blocktype data: recentforumposts - create_forumposts() for bulk creation of forumposts     additional:         - tidied up external feeds         - normalise() and validate fields in BehatGenerators to accept yes no
  Bug 1810990: blocktype data: recentforumpsts - create_forum() to create bulk forums
  Bug 1810990: blocktype data: recentforumposts - documentation
  Bug 1810990: blocktype data: plans -  documentation for create_task()
  Bug 1810990: blocktype: recentforumposts
  Bug 1810990: blocktype: plans (incl. create_task(), create_plan())     - additional: set_owner for creating owners of  artefacts
  Bug 1810990: blocktype: navigation     - additional: documentation and tidy up functions
  Bug 1810990: blocktype: creativecommons
  Bug 1810990: blocktypes: peerassessment, comment     - additional: documentation
  Bug 1810990: blocktypes: journal, journalentry     - additional: tidy up names
  Bug 1810990: blocktype: pdf
  Bug 1810990:  blocktype: internalmedia, behat columns, addition to upload_file    - additional: name changes and indentation
  Bug 1810990: behat table: removal of colummn, row, order     - text field removed in data column of text
  Bug 1810990:  behat table: clear up name changes and additional fields
  Bug 1810990: behat table: field names  data section     additional:         - rearrange order of functions folder, filedownload, gallery
  Bug 1810990: blocktype: html
  Bug 1810990: blocktype: folder   - reorganise generate_config functions alphabetically   - create_file_artefact function
  Bug 1810990: blocktypes: externalfeed,externalvideo,socialprofile,gallery,image       - reorganised switch into smaller functions       - indentation of code
  Bug 1810990: Beginning to get a behat background step for blocks
parents 31851afe 482e9ebc
......@@ -500,6 +500,7 @@ class ArtefactTypeBlog extends ArtefactType {
$newdescription = EmbeddedImage::prepare_embedded_images($artefact->get('description'), 'blog', $blogid);
$artefact->set('description', $newdescription);
db_commit();
return $blogid;
}
/**
......
......@@ -316,7 +316,6 @@ class PluginBlocktypeExternalvideo extends MaharaCoreBlocktype {
return $values;
}
// If it's an unrecognised url, do nothing.
if (!$urldata = self::process_url($values['videoid'], $values['width'], $values['height'])) {
return $values;
......@@ -326,7 +325,7 @@ class PluginBlocktypeExternalvideo extends MaharaCoreBlocktype {
return array_merge($values, $urldata);
}
private static function process_url($url, $width=0, $height=0) {
public static function process_url($url, $width=0, $height=0) {
$sources = self::load_media_sources();
foreach ($sources as $name => $source) {
......
......@@ -77,7 +77,7 @@ class BehatDataGenerators extends BehatBase {
'institution' => 'text',
'public' => 'bool',
),
'required' => array('name', 'owner'),
'required' => array('name', 'owner')
),
'institutions' => array(
'datagenerator' => 'institution',
......@@ -117,7 +117,21 @@ class BehatDataGenerators extends BehatBase {
'layout' => 'text',
'tags' => 'text',
),
'required' => array('title', 'ownertype', 'ownername'),
'required' => array('title', 'ownertype', 'ownername')
),
'blocks' => array(
'datagenerator' => 'block',
'available' => array(
'title' => 'text',
'type' => 'text',
'data' => 'text',
'page' => 'text',
/*'row' => 'text',
'column' => 'text',
'order' => 'text',*/
'retractable' => 'text',
),
'required' => array('title', 'type', 'page')
),
'collections' => array(
'datagenerator' => 'collection',
......@@ -128,7 +142,7 @@ class BehatDataGenerators extends BehatBase {
'ownername' => 'text',
'pages' => 'text',
),
'required' => array('title', 'ownertype', 'ownername'),
'required' => array('title', 'ownertype', 'ownername')
),
'permissions' => array(
'datagenerator' => 'permission',
......@@ -141,7 +155,7 @@ class BehatDataGenerators extends BehatBase {
'role' => 'text',
'multiplepermissions' => 'bool', // Set to true if wanting to add multiple access rules to a view
),
'required' => array('title', 'accesstype'),
'required' => array('title', 'accesstype')
),
'group memberships' => array(
'datagenerator' => 'group_membership',
......@@ -163,10 +177,10 @@ class BehatDataGenerators extends BehatBase {
'url' => 'text',
'urltext' => 'text',
),
'required' => array('emailtype', 'to', 'subject'),
'required' => array('emailtype', 'to', 'subject')
),
'journals' => array(
'datagenerator' => 'journal',
'datagenerator' => 'blog',
'available' => array(
'owner' => 'text',
'ownertype' => 'text',
......@@ -174,10 +188,10 @@ class BehatDataGenerators extends BehatBase {
'description' => 'text',
'tags' => 'text',
),
'required' => array('owner', 'ownertype', 'title'),
'required' => array('owner', 'ownertype', 'title')
),
'journalposts' => array(
'datagenerator' => 'journalpost',
'journalentries' => array(
'datagenerator' => 'blogpost',
'available' => array(
'owner' => 'text',
'ownertype' => 'text',
......@@ -187,8 +201,55 @@ class BehatDataGenerators extends BehatBase {
'tags' => 'text',
'draft' => 'bool',
),
'required' => array('owner', 'ownertype', 'title', 'entry'),
'required' => array('owner', 'ownertype', 'title', 'entry')
),
'plans' => array(
'datagenerator' => 'plan',
'available' => array(
'owner' => 'text',
'ownertype' => 'text',
'title' => 'text',
'description' => 'text',
'tags' => 'text',
),
'required' => array('owner', 'ownertype', 'title')
),
'tasks' => array(
'datagenerator' => 'task',
'available' => array(
'owner' => 'text',
'ownertype' => 'text',
'plan' => 'text',
'title' => 'text',
'description' => 'text',
'completiondate' => 'text',
'completed' => 'bool',
'tags' => 'text'
),
'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')
),
'forumposts' => array(
'datagenerator' => 'forumpost',
'available' => array(
'group' => 'text',
'forum' => 'text',
'subject' => 'text',
'message' => 'text',
'user' => 'text',
'topic' => 'text',
),
'required' => array('group', 'message', 'user')
)
);
/**
......@@ -197,18 +258,18 @@ class BehatDataGenerators extends BehatBase {
* @param array ('field' => 'values', ...) $record
* @return $record
*/
public function normalise(&$record) {
foreach ($record as &$value) {
$value = trim($value);
// Normalise boolean values
if (strtolower($value) == 'on' || $value == '1') {
$value = true;
}
else if (strtolower($value) == 'off' || $value == '0') {
$value = false;
}
}
}
public function normalise(&$record) {
foreach ($record as &$value) {
$value = trim($value);
// Normalise boolean values
if (strtolower($value) == 'on' || $value == '1' || $value == 'yes' || $value == 'true') {
$value = true;
}
else if (strtolower($value) == 'off' || $value == '0' || $value == 'no' || $value == 'false') {
$value = false;
}
}
}
/**
* Validate field values in a given record
......@@ -225,7 +286,7 @@ class BehatDataGenerators extends BehatBase {
"All available fields are " . implode(',', array_keys($availablefields)));
}
if ($availablefields[$fieldname] == 'bool' && !is_bool($fieldvalue)) {
throw new MaharaBehatTestException("The value '" . $fieldvalue . "' of the field '" . $fieldname . "' must be a boolean ('ON'|'OFF', '1'|'0' are accepted boolean values).");
throw new MaharaBehatTestException("The value '" . $fieldvalue . "' of the field '" . $fieldname . "' must be a boolean ('ON'|'OFF', '1'|'0', 'true'|'false', 'yes'|'no' are accepted boolean values).");
}
if ($availablefields[$fieldname] == 'number' && !is_numeric($fieldvalue)) {
throw new MaharaBehatTestException("The value '" . $fieldvalue . "' of the field '" . $fieldname . "' must be a number.");
......
@javascript @core @blocktype
Feature: Creating a page with blocks
As a user
I want to add a page with blocks as a background step
As a group admin
I want to add a page with blocks as a background step
Background:
Given the following "users" exist:
| username | password | email | firstname | lastname | institution | authname | role |
| UserA | Kupuh1pa!| UserA@example.org | Angela | User | mahara | internal | member |
| UserB | Kupuh1pa!| UserB@example.org | Bob | Boi | mahara | internal | member |
And the following "groups" exist:
| 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 "forumposts" exist:
| group | forum | topic | subject | message | user |
| Group1 | unicorns! | topic one | | mahara unicorns unite! | UserB |
| Group1 | unicorns! | topic one | | yay! mahara unicorns unite! | UserB |
| Group1 | unicorns! | topic one | cheer on | woo! mahara unicorns unite! | UserB |
| Group1 | | topic one | cheer on | 10 papercranes, let's go! | UserB |
| Group1 | unicorns! | topic one | extra subj | 100 papercranes, let's go! | UserB |
| Group1 | unicorns! | |origami | 1000 papercranes, let's go! | UserB |
And the following "pages" exist:
| title | description | ownertype | ownername |
| Page UserA_00 | Page 01 | user | UserA |
| Page UserB_00 | Page 01 | user | UserA |
| Page Grp1 | Page 01 | group | Group1 |
| Page One | test 01 | user | UserA |
| Page Two | test 01 | user | UserA |
| Page Three | test 01 | user | UserA |
And the following "collections" exist:
| title | ownertype | ownername | description | pages |
| collection one | user | UserA | desc of col |Page One,Page Two |
And the following "journals" exist:
| owner | ownertype | title | description | tags |
| UserA | user | journal1| this is journal1 | amber,brown,cobalt |
| Group1| group |journal2| this is journal1 | amber,brown,cobalt |
And the following "journalentries" exist:
| owner | ownertype | title | entry | blog | tags | draft |
| UserA | user | Entry One | This is my entry One | journal1 | cats,dogs | 0 |
| UserA | user | Entry Two | This is my entry Two | journal1 | cats,dogs | 0 |
| UserA | user | Entry Three | This is my entry Three | journal1 | cats,dogs | 0 |
| UserA | user | Entry Four | This is my entry Four | journal1 | cats,dogs | 0 |
| UserA | user | Entry Five | This is my entry Five | journal1 | cats,dogs | 0 |
| Group1 | group | Group e1 | This is my group entry | journal2 | | 0 |
And the following "plans" exist:
| owner | ownertype | title | description | tags |
| UserA | user | Plan One | This is my plan one | cats,dogs |
| UserA | user | Plan Two | This is my plan two | cats,dogs |
| Group1 | group | Group Plan | This is my group plan | unicorn |
And the following "tasks" exist:
| owner | ownertype | plan | title | description | completiondate | completed | tags |
| UserA | user | Plan One | Task One| Task One Description | 12/12/19 | no | cats,dogs |
| UserA | user | Plan One | Task Two| Task Two Description | 12/01/19 | yes | cats,dogs |
| UserA | user | Plan Two | Task 2a | Task 2a Description | 12/10/19 | yes | cats,dogs |
| UserA | user | Plan Two | Task 2b | Task 2b Description | 11/05/19 | yes | cats,dogs |
| UserA | user | Plan Two | Task 2c | Task 2c Description | 22/02/19 | yes | cats,dogs |
And the following "blocks" exist:
| title | type | page |retractable | data |
| My text 1 | text | Page UserA_00 | yes | This is some text |
| image jpg | image | Page UserA_00 | no | attachment=Image1.jpg; width=100 |
| image png | image | Page UserA_00 | no | attachment=Image2.png |
| My files 1 | filedownload | Page UserA_00 | auto | attachments=mahara_about.pdf |
| My files 2 | filedownload | Page UserA_00 | no | attachments=mahara_about.pdf,Image2.png |
| Rss news | externalfeed | Page UserA_00 | No | source=http://rss.nzherald.co.nz/rss/xml/nzhtsrsscid_000000698.xml;count=5 |
| Rss food | externalfeed | Page UserA_00 | no | source=http://www.thekitchenmaid.com/feed;count=3 |
| G image 3 | image | Page Grp1 | no | attachment=Image3.png |
| G files 2 | filedownload | Page Grp1 | no | attachments=mahara_about.pdf,Image2.png,testvid3.mp4,mahara.mp3 |
| nzslang | externalvideo | Page Grp1 | no | source=https://youtu.be/yRxFm70nOrY |
| my social | socialprofile | Page UserB_00 | no | sns=instagram,twitter,facebook,tumblr,pinterest,mysocialmedia |
| gall style1 | gallery | Page UserB_00 | no | attachments=Image1.jpg,Image3.png,Image3.png,Image2.png;imagesel=2;showdesc=yes;width=75;imagestyle=1;photoframe=1 |
| gall style2 | gallery | Page UserB_00 | yes | attachments=Image3.png,Image2.png,Image1.jpg;imagesel=2;showdesc=yes;width=75;imagestyle=2 |
| gall style3 | gallery | Page UserB_00 | yes | attachments=Image3.png,Image2.png,Image1.jpg;imagesel=2;showdesc=no;imagestyle=3;photoframe=0|
| myfolder | folder | Page UserB_00 | no | attachments=mahara_about.pdf,Image2.png,Image1.jpg,Image3.png,mahara.mp3;dirname=myfolder |
| my html | html | Page UserB_00 | yes | attachment=test_html.html |
| my blog | blog | Page One | no | copytype=nocopy;count=5;journaltitle=journal1 |
| my blogpost | blogpost | Page One | no | copytype=nocopy;journaltitle=journal1;entrytitle=Entry Two |
| Comments | comment | Page One | | |
| PeerAssessmt| peerassessment | Page One | auto | |
| creativecoms| creativecommons| Page One | no | commercialuse=yes;license=3.0;allowmods=no |
| my nav | navigation | Page Two | no | collection=collection one;copytoall=yes |
| my plan | plans | Page Two | no | plans=Plan One,Plan Two;tasksdisplaycount=10 |
| internalm v | internalmedia | Page Three | no | attachment=testvid3.mp4 |
| internalm a | internalmedia | Page Three | no | attachment=mahara.mp3 |
| my pdf | pdf | Page Three | no | attachment=mahara_about.pdf |
| recentposts |recentforumposts| Page Three | no | groupname=Group1;maxposts=3 |
| nzslang | externalvideo | Page Three | no | source=https://youtu.be/yRxFm70nOrY |
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"
And I set the following fields to these values:
| 3GPP media file | 1 |
| AVI video file | 1 |
| FLV flash movie | 1 |
| MP3 audio file | 1 |
| MP4 media file | 1 |
| MPEG movie | 1 |
| OGA audio file | 1 |
| OGG Vorbis audio file | 1 |
| OGV video file | 1 |
| QuickTime movie | 1 |
| WEBM video file | 1 |
| WMV video file | 1 |
And I press "Save"
And I log out
Then 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"
And I go to portfolio page "Page One"
And I go to portfolio page "Page Two"
And I go to portfolio page "Page Three"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment