Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
d417e4a1
Commit
d417e4a1
authored
Jan 16, 2019
by
Doris Tam
Browse files
Bug 1810990: blocktype: creativecommons
Change-Id: Ib737fbbbfa7ce19bdac765f886582b9254cc402e
parent
50ffe0ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/testing/classes/generator/TestingDataGenerator.php
View file @
d417e4a1
...
...
@@ -802,6 +802,50 @@ EOD;
return
$configdata
;
}
/**
* generate configdata and instance for blocktype: creativecommons
* @param string data inside the columm for data in behat table
* @return array $configdata of key and values for db table
*/
public
static
function
generate_configdata_creativecommons
(
$data
)
{
$configdata
=
array
();
// there is no compulsory filled field in this blocktype but there cannot
// be an empty array returned
if
(
!
$data
)
$configdata
[]
=
' '
;
$fields
=
explode
(
';'
,
$data
);
foreach
(
$fields
as
$field
)
{
list
(
$key
,
$value
)
=
explode
(
'='
,
$field
);
$value
=
trim
(
strtolower
(
$value
));
switch
(
$key
)
{
case
'commercialuse'
:
//yes=0, no=1
$configdata
[
'noncommercial'
]
=
$value
==
'yes'
?
0
:
1
;
break
;
case
'license'
:
//must be 3.0 or 2.0
if
(
$value
==
3.0
||
$value
==
2.0
)
{
$configdata
[
'version'
]
=
(
string
)(
$value
*
10
);
}
else
$configdata
[
'version'
]
=
'30'
;
break
;
case
'allowmods'
:
//yes=0, yes(with mutual sharing)=1, no=2
if
(
$value
==
'yes'
)
$configdata
[
'noderivatives'
]
=
'0'
;
if
(
$value
==
'yeswithsharing'
)
$configdata
[
'noderivatives'
]
=
'1'
;
if
(
$value
==
'no'
)
$configdata
[
'noderivatives'
]
=
'2'
;
break
;
default
:
break
;
}
}
$configdata
=
PluginBlocktypeCreativecommons
::
instance_config_save
(
$configdata
);
return
$configdata
;
}
/**
* generate configdata for the blocktype: rss feeds/external feeds
* @param string $data inside data column in behat test
...
...
test/behat/features/user_content/test.feature
View file @
d417e4a1
...
...
@@ -65,6 +65,8 @@ Background:
|
Comments
|
comment
|
Page
One
|
|
no
configdata
|
|
PeerAssessmt
|
peerassessment
|
Page
One
|
auto
|
no
configdata
|
# creative commons options for allowmods= yes, no, yeswithsharing
|
creativecoms
|
creativecommons
|
Page
One
|
no
|
commercialuse=yes;license=3.0;allowmods=no
|
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment