Skip to content

Commit

Permalink
MDL-42625 behat: Fixing ExpectationException::__construct() call
Browse files Browse the repository at this point in the history
Also adding an extra checking to the selector to
ensure it is no updating the list of files.
  • Loading branch information
David Monllao committed Dec 11, 2013
1 parent 0e72987 commit c5a1015
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions repository/tests/behat/behat_filepicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,16 @@ public function i_delete_file_from_filemanager($name, $filemanagerelement) {
*/
public function i_should_see_elements_in_filemanager($elementscount, $filemanagerelement) {
$filemanagernode = $this->get_filepicker_node($filemanagerelement);
$elements = $this->find_all('css', '.fp-content .fp-file', false, $filemanagernode);

// We count .fp-file elements inside a filemanager not being updated.
$xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' filemanager ')]" .
"[not(contains(concat(' ', normalize-space(@class), ' '), ' fm-updating '))]" .
"//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-content ')]" .
"//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-file ')]";

$elements = $this->find_all('xpath', $xpath, false, $filemanagernode);
if (count($elements) != $elementscount) {
throw new ExpectationException('Found '.count($elements).' elements in filemanager instead of expected '.$elementscount);
throw new ExpectationException('Found '.count($elements).' elements in filemanager instead of expected '.$elementscount, $this->getSession());
}
}

Expand Down

0 comments on commit c5a1015

Please sign in to comment.