Merge branch 'MDL-38346_master' of git://github.com/dmonllao/moodle
This commit is contained in:
@@ -43,7 +43,7 @@ Feature: Transform steps arguments
|
||||
And I follow "Edit profile"
|
||||
Then I should not see "NASTYSTRING"
|
||||
And the "First name" field should match "va\"lue1" value
|
||||
And the "Description" field should match "va\"lue2" value
|
||||
And the "Description" field should match "va\\"lue2" value
|
||||
And the "City/town" field should match "va\"lue3" value
|
||||
|
||||
@javascript
|
||||
|
||||
@@ -4,8 +4,7 @@ Feature: Allowed blocks controls
|
||||
As an admin
|
||||
I need to restrict some blocks to be used in courses
|
||||
|
||||
@javascript
|
||||
Scenario: Blocks can be added with the default permissions
|
||||
Background:
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
@@ -15,7 +14,10 @@ Feature: Allowed blocks controls
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
|
||||
@javascript
|
||||
Scenario: Blocks can be added with the default permissions
|
||||
Given I log in as "teacher1"
|
||||
And I follow "Course $NASTYSTRING1"
|
||||
And I turn editing mode on
|
||||
When I add the "Course completion status" block
|
||||
@@ -25,16 +27,7 @@ Feature: Allowed blocks controls
|
||||
|
||||
@javascript
|
||||
Scenario: Blocks can not be added when the admin restricts the permissions
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course $NASTYSTRING1 | C1 | 0 |
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "admin"
|
||||
Given I log in as "admin"
|
||||
And I set the following system permissions of "Teacher" role:
|
||||
| block/activity_modules:addinstance | Prohibit |
|
||||
And I am on homepage
|
||||
|
||||
@@ -56,7 +56,7 @@ class nasty_strings {
|
||||
'\' \\" \ \'$@NULL@$ @@TEST@@ < > & < > & \\\" \\ , ; : . 日本語% %%',
|
||||
'\\\" \\ , ; : . 日本語% < > & < > & \' \\" \ \'$@NULL@$ @@TEST@@ %%',
|
||||
'< > & < > & \' \\" \ \'$@NULL@$ 日本語% %% @@TEST@@ \\\" \\ . , ; :',
|
||||
'. 日本語& \' \\"< > & < > \\\" \\ , ; : \ \'$@NULL@$ @@TEST@@% %%',
|
||||
'. 日本語& \' \\" < > & < > \\ , ; : \ \'$@NULL@$ \\\" @@TEST@@% %%',
|
||||
'& \' \\" \ < > & < > \\\" \\ , ; : . 日本語\'$@NULL@$ @@TEST@@% %%',
|
||||
);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class behat_transformations extends behat_base {
|
||||
* @return string The string with the arguments fixed.
|
||||
*/
|
||||
public function arg_replace_slashes($string) {
|
||||
return $this->replace_slashes($string);
|
||||
return str_replace('\"', '"', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,8 +73,8 @@ class behat_transformations extends behat_base {
|
||||
/**
|
||||
* Transformations for TableNode arguments.
|
||||
*
|
||||
* All the transformations have to be applied to tables,
|
||||
* adding them in a different method for Behat API restrictions.
|
||||
* Transformations applicable to TableNode arguments should also
|
||||
* be applied, adding them in a different method for Behat API restrictions.
|
||||
*
|
||||
* @Transform /^table:(.*)/
|
||||
* @param TableNode $tablenode
|
||||
@@ -87,9 +87,6 @@ class behat_transformations extends behat_base {
|
||||
foreach ($rows as $rowkey => $row) {
|
||||
foreach ($row as $colkey => $value) {
|
||||
|
||||
// TableNodes values doesn't need to be escaped, but maybe somebody does it.
|
||||
$rows[$rowkey][$colkey] = $this->replace_slashes($value);
|
||||
|
||||
// Transforms vars into nasty strings.
|
||||
if (preg_match('/\$NASTYSTRING(\d)/', $rows[$rowkey][$colkey])) {
|
||||
$rows[$rowkey][$colkey] = $this->replace_nasty_strings($rows[$rowkey][$colkey]);
|
||||
@@ -102,18 +99,6 @@ class behat_transformations extends behat_base {
|
||||
return $tablenode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the escaped double quotes.
|
||||
*
|
||||
* Method reused by TableNode transformation.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public function replace_slashes($string) {
|
||||
return str_replace('\"', '"', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces $NASTYSTRING vars for a nasty string.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user