Skip to content

Commit

Permalink
Merge branch 'MDL-37958_master-fix' of git://github.com/dmonllao/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Mar 6, 2013
2 parents 31c7589 + e8a88eb commit 4384eea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
19 changes: 13 additions & 6 deletions blocks/tests/behat/restrict_available_blocks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Feature: Allowed blocks controls
As an admin
I need to restrict some blocks to be used in courses

Background:
@javascript
Scenario: Blocks can be added with the default permissions
Given the following "users" exists:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
Expand All @@ -14,10 +15,7 @@ Feature: Allowed blocks controls
And the following "course enrolments" exists:
| user | course | role |
| teacher1 | C1 | editingteacher |

@javascript
Scenario: Blocks can be added with the default permissions
Given I log in as "teacher1"
And I log in as "teacher1"
And I follow "Course $NASTYSTRING1"
And I turn editing mode on
When I add the "Course completion status" block
Expand All @@ -27,7 +25,16 @@ Feature: Allowed blocks controls

@javascript
Scenario: Blocks can not be added when the admin restricts the permissions
Given I log in as "admin"
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"
And I set the following system permissions of "Teacher" role:
| block/activity_modules:addinstance | Prohibit |
And I am on homepage
Expand Down
6 changes: 6 additions & 0 deletions lib/behat/behat_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ protected function find_all($selector, $locator, $exception = false, $node = fal
if ($selector == 'named') {
$exceptiontype = $locator[0];
$exceptionlocator = $locator[1];

// If we are in a @javascript session all contents would be displayed as HTML characters.
if (get_class($this->getSession()->getDriver()) === 'Behat\Mink\Driver\Selenium2Driver') {
$locator[1] = html_entity_decode($locator[1], ENT_NOQUOTES);
}

} else {
$exceptiontype = $selector;
$exceptionlocator = $locator;
Expand Down
20 changes: 10 additions & 10 deletions lib/testing/classes/nasty_strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ class nasty_strings {
* @var array
*/
protected static $strings = array(
'< > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ @@TEST@@ \\\" \\ , ; : .  日本語 ­ % %% ',
'&amp; \' \\" \ \'$@NULL@$ < > & &lt; &gt; @@TEST@@ \\\" \\ , ; : .  日本語 ­ % %% ',
'< > & &lt; &gt; &amp; \' \\" \ \\\" \\ , ; : .  \'$@NULL@$ @@TEST@@ 日本語 ­ % %% ',
'< > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ 日本語 ­ % %%@@TEST@@ \\\" \\ , ; :',
'< > & &lt; &gt; \\\" \\ , ; : .  日本語&amp; \' \\" \ \'$@NULL@$ @@TEST@@ ­ % %% ',
'\' \\" \ \'$@NULL@$ @@TEST@@ < > & &lt; &gt; &amp; \\\" \\ , ; : .  日本語 ­ % %% ',
'\\\" \\ , ; : .  日本語 ­ % < > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ @@TEST@@ %% ',
'< > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ 日本語 ­ % %% @@TEST@@ \\\" \\ , ; :',
' 日本語&amp; \' \\"< > & &lt; &gt; \\\" \\ , ; : \ \'$@NULL@$ @@TEST@@ ­ % %% ',
'&amp; \' \\" \ < > & &lt; &gt; \\\" \\ , ; : .  日本語\'$@NULL@$ @@TEST@@ ­ % %% ',
'< > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ @@TEST@@ \\\" \\ , ; : . 日本語­% %%',
'&amp; \' \\" \ \'$@NULL@$ < > & &lt; &gt; @@TEST@@ \\\" \\ , ; : . 日本語­% %%',
'< > & &lt; &gt; &amp; \' \\" \ \\\" \\ , ; : . \'$@NULL@$ @@TEST@@ 日本語­% %%',
'< > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ 日本語­% %%@@TEST@@ \\\" \\ , ; :',
'< > & &lt; &gt; \\\" \\ , ; : . 日本語&amp; \' \\" \ \'$@NULL@$ @@TEST@@­% %%',
'\' \\" \ \'$@NULL@$ @@TEST@@ < > & &lt; &gt; &amp; \\\" \\ , ; : . 日本語­% %%',
'\\\" \\ , ; : . 日本語­% < > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ @@TEST@@ %%',
'< > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ 日本語­% %% @@TEST@@ \\\" \\ , ; :',
'. 日本語&amp; \' \\"< > & &lt; &gt; \\\" \\ , ; : \ \'$@NULL@$ @@TEST@@­% %%',
'&amp; \' \\" \ < > & &lt; &gt; \\\" \\ , ; : . 日本語\'$@NULL@$ @@TEST@@­% %%',
);

/**
Expand Down

0 comments on commit 4384eea

Please sign in to comment.