Commit 9813474c authored by Doris Tam's avatar Doris Tam
Browse files

Bug 1810990: blocktype: pdf

Change-Id: Ia15f24b36ad0ac47d1f34cc1c270246235902b3d
parent b55025f2
<?php
create_artefact(<?php
/**
* @package mahara
* @subpackage test/generator
......@@ -987,6 +987,32 @@ EOD;
return $configdata;
}
/**
* generate config data for the blocktype: pdf
**/
public static function generate_configdata_pdf($data, $ownertype, $ownerid) {
if (!$data) return;
list($key, $value) = explode('=', $data);
$key=trim($key);
$value=trim($value);
if ($key == 'attachment') {
$key = 'artefactid';
// we need to find the id of the item we are trying to attach and save it as artefactid
if (!$artefactid = get_field('artefact', 'id', 'title', $value, $ownertype, $ownerid)) {
$artefactid = TestingDataGenerator::create_artefact($file=$value, $ownertype, $ownerid, 'attachment');
TestingDataGenerator::file_creation($artefactid, $value, $ownertype, $ownerid);
}
$value = $artefactid;
$configdata = array();
$configdata[$key] = $value;
}
return $configdata;
}
/**
* generate config data for the blocktype: social profile
* @param string $data inside data column in behat test
......
......@@ -41,9 +41,10 @@ Background:
| 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 |
| internalm v | internalmedia| Page UserB_00 | no | attachment=testvid3.mp4 |
| internalm a | internalmedia| Page UserB_00 | no | attachment=mahara.mp3 |
| my pdf | pdf | Page UserB_00 | no | attachment=mahara_about.pdf |
......
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