Commit 5f2776a7 authored by Doris Tam's avatar Doris Tam
Browse files

Bug 1810990: behat table: removal of colummn, row, order

    - text field removed in data column of text

Change-Id: I76ae7879049f59429501a84fab7bc01bf051e18a
parent 6b1f556c
......@@ -26,6 +26,9 @@ class TestingDataGenerator {
protected $institutioncount = 0;
protected $tagcount = 0;
/** @var array list to track location to know where to create block on each view **/
protected $viewcolcounts = array();
/** @var array list of plugin generators */
protected $generators = array();
......@@ -66,6 +69,7 @@ EOD;
$this->usercounter = 0;
$this->$groupcount = 0;
$this->$institutioncount = 0;
$this->viewcolcounts = array();
foreach ($this->generators as $generator) {
$generator->reset();
......@@ -638,7 +642,7 @@ EOD;
/**
* Create block content for existing view
* @param array $record
* @param array $record data for each blocktype in each row of the testing table
* @throws SystemException if creating failed
* @return int new block id
*/
......@@ -646,6 +650,12 @@ EOD;
global $USER;
$sql = "SELECT id FROM {view} WHERE LOWER(TRIM(title)) = ?";
$page = strtolower(trim($record['page']));
//first block on a page/view set column to 1
if (!isset($this->viewcolcounts[$page])) {
$this->viewcolcounts[$page] = 1;
}
$ids = get_records_sql_array($sql, array($page));
if (!$ids || count($ids) > 1) {
throw new SystemException("Invalid page name '" . $record['page'] . "'. The page title does not exist, or is duplicated.");
......@@ -666,6 +676,9 @@ EOD;
$ownerid = $view->get('owner');
}
}
$maxcols = 3;
// We have a valid page so lets see if we can add a block to it
$blocktype = strtolower(trim($record['type']));
// Check that the blocktype exists and is active
......@@ -673,13 +686,6 @@ EOD;
throw new SystemException("Invalid block type '" . $record['type'] . "'. The block type is either not installed or not active.");
}
$title = strtolower(trim($record['title']));
// Make sure we have row/column/order set or use defaults
$row = (int)trim($record['row']);
$row = !empty($row) ? $row : 1;
$column = (int)trim($record['column']);
$column = !empty($column) ? $column : 1;
$order = (int)trim($record['order']);
$order = !empty($order) ? $order : 1;
// build configdata
$configdata = $this->setup_retractable($record['retractable']);
......@@ -702,12 +708,13 @@ EOD;
'blocktype' => $blocktype,
'title' => $title,
'view' => $view->get('id'),
'row' => $row,
'column' => $column,
'order' => $order,
'row' => 1,
)
);
$bi->set('order', $view->get_current_max_order(1, $this->viewcolcounts[$page]) + 1);
$bi->set('configdata', $configdata);
$bi->set('column', $this->viewcolcounts[$page]);
$this->viewcolcounts[$page] = (($this->viewcolcounts[$page]+1) % $maxcols) ? ($this->viewcolcounts[$page]+1) % $maxcols : $maxcols;
$bi->commit();
}
......@@ -937,10 +944,6 @@ EOD;
return $configdata;
}
public static function generate_configdata_internalmedia($data, $ownertype, $ownerid) {
if (!$data) return;
}
/**
* generate config data for the blocktype: social profile
* @param string $data inside data column in behat test
......
......@@ -126,9 +126,9 @@ class BehatDataGenerators extends BehatBase {
'type' => 'text',
'data' => 'text',
'page' => 'text',
'row' => 'text',
/*'row' => 'text',
'column' => 'text',
'order' => 'text',
'order' => 'text',*/
'retractable' => 'text',
),
......
......@@ -22,23 +22,26 @@ Background:
| Page Grp1 | Page 01 | group | Group1 |
And the following "blocks" exist:
| title | type | page | row | column | order |retractable | data |
| My text 1 | text | Page UserA_00 | 1 | 1 | 1 | yes | This is some text |
| image jpg | image | Page UserA_00 | 1 | 1 | 2 | no | attachment=Image1.jpg; width=100 |
| image png | image | Page UserA_00 | 1 | 1 | 3 | no | attachment=Image2.png |
| My files 1 | filedownload | Page UserA_00 | 1 | 2 | 1 | auto | attachments=mahara_about.pdf |
| My files 2 | filedownload | Page UserA_00 | 1 | 2 | 2 | no | attachments=mahara_about.pdf,Image2.png |
| Rss news | externalfeed | Page UserA_00 | 1 | 3 | 1 | No | source=http://rss.nzherald.co.nz/rss/xml/nzhtsrsscid_000000698.xml |
| Rss food | externalfeed | Page UserA_00 | 1 | 3 | 2 | no | source=http://www.thekitchenmaid.com/feed |
| G image 3 | image | Page Grp1 | 1 | 1 | 1 | no | attachment=Image3.png |
| G files 2 | filedownload | Page Grp1 | 1 | 1 | 2 | no | attachments=mahara_about.pdf,Image2.png |
| nzslang | externalvideo| Page Grp1 | 1 | 1 | 3 | no | source=https://youtu.be/yRxFm70nOrY |
| my social | socialprofile| Page UserB_00 | 1 | 1 | 1 | no | sns=instagram,twitter,facebook,tumblr,pinterest |
| gall style1 | gallery | Page UserB_00 | 1 | 2 | 1 | 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 | 1 | 2 | 2 | yes | attachments=Image3.png,Image2.png,Image1.jpg;imagesel=2;showdesc=yes;width=75;imagestyle=2 |
| gall style3 | gallery | Page UserB_00 | 1 | 2 | 3 | yes | attachments=Image3.png,Image2.png,Image1.jpg;imagesel=2;showdesc=no;imagestyle=3;photoframe=0|
| myfolder | folder | Page UserB_00 | 1 | 2 | 4 | no | dirname=myfolder;attachments=mahara_about.pdf,Image2.png,Image1.jpg,Image3.png |
| my html | html | Page UserB_00 | 1 | 3 | 1 | yes | attachment=test_html.html |
| 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 |
| Rss food | externalfeed | Page UserA_00 | no | source=http://www.thekitchenmaid.com/feed |
| G image 3 | image | Page Grp1 | no | attachment=Image3.png |
| G files 2 | filedownload | Page Grp1 | no | attachments=mahara_about.pdf,Image2.png |
| nzslang | externalvideo| Page Grp1 | no | source=https://youtu.be/yRxFm70nOrY |
| my social | socialprofile| Page UserB_00 | no | sns=instagram,twitter,facebook,tumblr,pinterest |
| 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 | dirname=myfolder;attachments=mahara_about.pdf,Image2.png,Image1.jpg,Image3.png |
| my html | html | Page UserB_00 | yes | attachment=test_html.html |
Scenario: Create Page UserA_00 with text blocks
Given I log in as "UserA" with password "Kupuh1pa!"
......
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