当前位置: 首页>>代码示例>>PHP>>正文


PHP behat_context_helper::escape方法代码示例

本文整理汇总了PHP中behat_context_helper::escape方法的典型用法代码示例。如果您正苦于以下问题:PHP behat_context_helper::escape方法的具体用法?PHP behat_context_helper::escape怎么用?PHP behat_context_helper::escape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在behat_context_helper的用法示例。


在下文中一共展示了behat_context_helper::escape方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: i_add_user_to_group_members

 /**
  * Add the specified user to the group. You should be in the groups page when running this step. The user should be specified like "Firstname Lastname (user@example.com)".
  *
  * @Given /^I add "(?P<user_fullname_string>(?:[^"]|\\")*)" user to "(?P<group_name_string>(?:[^"]|\\")*)" group members$/
  * @throws ElementNotFoundException Thrown by behat_base::find
  * @param string $username
  * @param string $groupname
  */
 public function i_add_user_to_group_members($userfullname, $groupname)
 {
     $userfullname = behat_context_helper::escape($userfullname);
     // Using a xpath liternal to avoid problems with quotes and double quotes.
     $groupname = behat_context_helper::escape($groupname);
     // We don't know the option text as it contains the number of users in the group.
     $select = $this->find_field('groups');
     $xpath = "//select[@id='groups']/descendant::option[contains(., {$groupname})]";
     $groupoption = $this->find('xpath', $xpath);
     $fulloption = $groupoption->getText();
     $select->selectOption($fulloption);
     // This is needed by some drivers to ensure relevant event is triggred and button is enabled.
     $script = "Syn.trigger('change', {}, {{ELEMENT}})";
     $this->getSession()->getDriver()->triggerSynScript($select->getXpath(), $script);
     $this->getSession()->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS);
     // Here we don't need to wait for the AJAX response.
     $this->find_button(get_string('adduserstogroup', 'group'))->click();
     // Wait for add/remove members page to be loaded.
     $this->getSession()->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS);
     // Getting the option and selecting it.
     $select = $this->find_field('addselect');
     $xpath = "//select[@id='addselect']/descendant::option[contains(., {$userfullname})]";
     $memberoption = $this->find('xpath', $xpath);
     $fulloption = $memberoption->getText();
     $select->selectOption($fulloption);
     // Click add button.
     $this->find_button(get_string('add'))->click();
     // Wait for the page to load.
     $this->getSession()->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS);
     // Returning to the main groups page.
     $this->find_button(get_string('backtogroups', 'group'))->click();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:40,代码来源:behat_groups.php

示例2: i_add_a_reviewer_for_workshop_participant

 /**
  * Manually adds a reviewer for workshop participant.
  *
  * This step should start on manual allocation page.
  *
  * @When /^I add a reviewer "(?P<reviewer_name_string>(?:[^"]|\\")*)" for workshop participant "(?P<participant_name_string>(?:[^"]|\\")*)"$/
  * @param string $reviewername
  * @param string $participantname
  */
 public function i_add_a_reviewer_for_workshop_participant($reviewername, $participantname)
 {
     $participantnameliteral = behat_context_helper::escape($participantname);
     $xpathtd = "//table[contains(concat(' ', normalize-space(@class), ' '), ' allocations ')]/" . "tbody/tr[./td[contains(concat(' ', normalize-space(@class), ' '), ' peer ')]" . "[contains(.,{$participantnameliteral})]]/" . "td[contains(concat(' ', normalize-space(@class), ' '), ' reviewedby ')]";
     $xpathselect = $xpathtd . "/descendant::select";
     try {
         $selectnode = $this->find('xpath', $xpathselect);
     } catch (Exception $ex) {
         $this->find_button(get_string('showallparticipants', 'workshopallocation_manual'))->press();
         $selectnode = $this->find('xpath', $xpathselect);
     }
     $selectformfield = behat_field_manager::get_form_field($selectnode, $this->getSession());
     $selectformfield->set_value($reviewername);
     if (!$this->running_javascript()) {
         // Without Javascript we need to press the "Go" button.
         $go = behat_context_helper::escape(get_string('go'));
         $this->find('xpath', $xpathtd . "/descendant::input[@value={$go}]")->click();
     } else {
         // With Javascript we just wait for the page to reload.
         $this->getSession()->wait(self::EXTENDED_TIMEOUT, self::PAGE_READY_JS);
     }
     // Check the success string to appear.
     $allocatedtext = behat_context_helper::escape(get_string('allocationadded', 'workshopallocation_manual'));
     $this->find('xpath', "//*[contains(.,{$allocatedtext})]");
 }
开发者ID:evltuma,项目名称:moodle,代码行数:34,代码来源:behat_workshopallocation_manual.php

示例3: user_has_not_completed_activity

 /**
  * Checks that the specified user has not completed the specified activity of the current course.
  *
  * @Then /^"(?P<user_fullname_string>(?:[^"]|\\")*)" user has not completed "(?P<activity_name_string>(?:[^"]|\\")*)" activity$/
  * @param string $userfullname
  * @param string $activityname
  */
 public function user_has_not_completed_activity($userfullname, $activityname)
 {
     // Will throw an exception if the element can not be hovered.
     $titleliteral = behat_context_helper::escape($userfullname . ", " . $activityname . ": Not completed");
     $xpath = "//table[@id='completion-progress']" . "/descendant::img[contains(@title, {$titleliteral})]";
     $this->execute("behat_completion::go_to_the_current_course_activity_completion_report");
     $this->execute("behat_general::should_exist", array($this->escape($xpath), "xpath_element"));
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:15,代码来源:behat_completion.php

示例4: i_should_see_question_in_section_in_the_quiz_navigation

 public function i_should_see_question_in_section_in_the_quiz_navigation($questionnumber, $sectionheading)
 {
     // Using xpath literal to avoid quotes problems.
     $questionnumberliteral = behat_context_helper::escape('Question ' . $questionnumber);
     $headingliteral = behat_context_helper::escape($sectionheading);
     // Split in two checkings to give more feedback in case of exception.
     $exception = new ExpectationException('Question "' . $questionnumber . '" is not in section "' . $sectionheading . '" in the quiz navigation.', $this->getSession());
     $xpath = "//*[@id = 'mod_quiz_navblock']//*[contains(concat(' ', normalize-space(@class), ' '), ' qnbutton ') and " . "contains(., {$questionnumberliteral}) and contains(preceding-sibling::h3[1], {$headingliteral})]";
     $this->find('xpath', $xpath);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:10,代码来源:behat_theme_boost_behat_mod_quiz.php

示例5: get_top_navigation_node

 protected function get_top_navigation_node($nodetext)
 {
     // Avoid problems with quotes.
     $nodetextliteral = behat_context_helper::escape($nodetext);
     $exception = new ExpectationException('Top navigation node "' . $nodetext . ' not found in "', $this->getSession());
     // First find in navigation block.
     $xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' card-text ')]" . "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . "/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . "[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . "/span[normalize-space(.)=" . $nodetextliteral . "]]" . "|" . "//div[contains(concat(' ', normalize-space(@class), ' '), ' card-text ')]/div" . "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . "/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . "/ul/li[contains(concat(' ', normalize-space(@class), ' '), ' contains_branch ')]" . "[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . "/span[normalize-space(.)=" . $nodetextliteral . "]]" . "|" . "//div[contains(concat(' ', normalize-space(@class), ' '), ' card-text ')]/div" . "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . "/li[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . "/span[normalize-space(.)=" . $nodetextliteral . "]]" . "|" . "//div[contains(concat(' ', normalize-space(@class), ' '), ' card-text ')]/div" . "/ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" . "/li[p[contains(concat(' ', normalize-space(@class), ' '), ' branch ')]" . "/a[normalize-space(.)=" . $nodetextliteral . "]]";
     $node = $this->find('xpath', $xpath, $exception);
     return $node;
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:10,代码来源:behat_theme_boost_behat_navigation.php

示例6: set_value

 /**
  * Sets the value(s) of an availability element.
  *
  * At present this only supports the following value 'Grouping: xxx' where
  * xxx is the name of a grouping. Additional value types can be added as
  * necessary.
  *
  * @param string $value Value code
  * @return void
  */
 public function set_value($value)
 {
     global $DB;
     $driver = $this->session->getDriver();
     // Check the availability condition is currently unset - we don't yet
     // support changing an existing one.
     $existing = $this->get_value();
     if ($existing && $existing !== '{"op":"&","c":[],"showc":[]}') {
         throw new Exception('Cannot automatically set availability when ' . 'there is existing setting - must clear manually');
     }
     // Check the value matches a supported format.
     $matches = array();
     if (!preg_match('~^\\s*([^:]*):\\s*(.*?)\\s*$~', $value, $matches)) {
         throw new Exception('Value for availability field does not match correct ' . 'format. Example: "Grouping: G1"');
     }
     $type = $matches[1];
     $param = $matches[2];
     if ($this->running_javascript()) {
         switch (strtolower($type)) {
             case 'grouping':
                 // Set a grouping condition.
                 $driver->click('//div[@class="availability-button"]/button');
                 $driver->click('//button[@id="availability_addrestriction_grouping"]');
                 $escparam = behat_context_helper::escape($param);
                 $nodes = $driver->find('//span[contains(concat(" " , @class, " "), " availability_grouping ")]//' . 'option[normalize-space(.) = ' . $escparam . ']');
                 if (count($nodes) != 1) {
                     throw new Exception('Cannot find grouping in dropdown' . count($nodes));
                 }
                 $node = reset($nodes);
                 $value = $node->getValue();
                 $driver->selectOption('//span[contains(concat(" " , @class, " "), " availability_grouping ")]//' . 'select', $value);
                 break;
             default:
                 // We don't support other types yet. The test author must write
                 // manual 'click on that button, etc' commands.
                 throw new Exception('The availability type "' . $type . '" is currently not supported - must set manually');
         }
     } else {
         $courseid = $driver->getValue('//input[@name="course"]');
         switch (strtolower($type)) {
             case 'grouping':
                 // Define result with one grouping condition.
                 $groupingid = $DB->get_field('groupings', 'id', array('courseid' => $courseid, 'name' => $param));
                 $json = \core_availability\tree::get_root_json(array(\availability_grouping\condition::get_json($groupingid)));
                 break;
             default:
                 // We don't support other types yet.
                 throw new Exception('The availability type "' . $type . '" is currently not supported - must set with JavaScript');
         }
         $driver->setValue('//textarea[@name="availabilityconditionsjson"]', json_encode($json));
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:62,代码来源:behat_form_availability.php

示例7: get_behat_selector

 /**
  * Returns the behat selector and locator for a given moodle selector and locator
  *
  * @param string $selectortype The moodle selector type, which includes moodle selectors
  * @param string $element The locator we look for in that kind of selector
  * @param Session $session The Mink opened session
  * @return array Contains the selector and the locator expected by Mink.
  */
 public static function get_behat_selector($selectortype, $element, Behat\Mink\Session $session)
 {
     // CSS and XPath selectors locator is one single argument.
     if ($selectortype == 'css_element' || $selectortype == 'xpath_element') {
         $selector = str_replace('_element', '', $selectortype);
         $locator = $element;
     } else {
         // Named selectors uses arrays as locators including the type of named selector.
         $locator = array($selectortype, behat_context_helper::escape($element));
         $selector = 'named_partial';
     }
     return array($selector, $locator);
 }
开发者ID:janeklb,项目名称:moodle,代码行数:21,代码来源:behat_selectors.php

示例8: the_state_of_question_is_shown_as

 /**
  * Checks the state of the specified question.
  *
  * @Then /^the state of "(?P<question_description_string>(?:[^"]|\\")*)" question is shown as "(?P<state_string>(?:[^"]|\\")*)"$/
  * @throws ExpectationException
  * @throws ElementNotFoundException
  * @param string $questiondescription
  * @param string $state
  */
 public function the_state_of_question_is_shown_as($questiondescription, $state)
 {
     // Using xpath literal to avoid quotes problems.
     $questiondescriptionliteral = behat_context_helper::escape($questiondescription);
     $stateliteral = behat_context_helper::escape($state);
     // Split in two checkings to give more feedback in case of exception.
     $exception = new ElementNotFoundException($this->getSession(), 'Question "' . $questiondescription . '" ');
     $questionxpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' que ')]" . "[contains(div[@class='content']/div[contains(concat(' ', normalize-space(@class), ' '), ' formulation ')]," . "{$questiondescriptionliteral})]";
     $this->find('xpath', $questionxpath, $exception);
     $exception = new ExpectationException('Question "' . $questiondescription . '" state is not "' . $state . '"', $this->getSession());
     $xpath = $questionxpath . "/div[@class='info']/div[@class='state' and contains(., {$stateliteral})]";
     $this->find('xpath', $xpath, $exception);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:22,代码来源:behat_question.php

示例9: i_delete_comment_from_comments_block

 /**
  * Deletes the specified comment from the current page's comments block.
  *
  * @Given /^I delete "(?P<comment_text_string>(?:[^"]|\\")*)" comment from comments block$/
  * @throws ElementNotFoundException
  * @throws ExpectationException
  * @param string $comment
  */
 public function i_delete_comment_from_comments_block($comment)
 {
     $exception = new ElementNotFoundException($this->getSession(), '"' . $comment . '" comment ');
     // Using xpath liternal to avoid possible problems with comments containing quotes.
     $commentliteral = behat_context_helper::escape($comment);
     $commentxpath = "//*[contains(concat(' ', normalize-space(@class), ' '), ' block_comments ')]" . "/descendant::div[@class='comment-message'][contains(., {$commentliteral})]";
     $commentnode = $this->find('xpath', $commentxpath, $exception);
     // Click on delete icon.
     $deleteexception = new ExpectationException('"' . $comment . '" comment can not be deleted', $this->getSession());
     $deleteicon = $this->find('css', '.comment-delete a img', $deleteexception, $commentnode);
     $deleteicon->click();
     // Wait for the animation to finish, in theory is just 1 sec, adding 4 just in case.
     $this->getSession()->wait(4 * 1000, false);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:22,代码来源:behat_block_comments.php

示例10: get_filepicker_node

 protected function get_filepicker_node($filepickerelement)
 {
     // More info about the problem (in case there is a problem).
     $exception = new ExpectationException('"' . $filepickerelement . '" filepicker can not be found', $this->getSession());
     // If no file picker label is mentioned take the first file picker from the page.
     if (empty($filepickerelement)) {
         $filepickercontainer = $this->find('xpath', "//*[@data-fieldtype=\"filemanager\"]", $exception);
     } else {
         // Gets the ffilemanager node specified by the locator which contains the filepicker container.
         $filepickerelement = behat_context_helper::escape($filepickerelement);
         $filepickercontainer = $this->find('xpath', "//input[./@id = //label[normalize-space(.)={$filepickerelement}]/@for]" . "//ancestor::*[@data-fieldtype = 'filemanager' or @data-fieldtype = 'filepicker']", $exception);
     }
     return $filepickercontainer;
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:14,代码来源:behat_theme_boost_behat_files.php

示例11: i_set_the_following_administration_settings_values

 public function i_set_the_following_administration_settings_values(TableNode $table)
 {
     if (!($data = $table->getRowsHash())) {
         return;
     }
     foreach ($data as $label => $value) {
         // We expect admin block to be visible, otherwise go to homepage.
         if (!$this->getSession()->getPage()->find('css', '.block_settings')) {
             $this->getSession()->visit($this->locate_path('/'));
             $this->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS);
         }
         // Search by label.
         $searchbox = $this->find_field(get_string('searchinsettings', 'admin'));
         $searchbox->setValue($label);
         $submitsearch = $this->find('css', 'form.adminsearchform input[type=submit]');
         $submitsearch->press();
         $this->wait(self::TIMEOUT * 1000, self::PAGE_READY_JS);
         // Admin settings does not use the same DOM structure than other moodle forms
         // but we also need to use lib/behat/form_field/* to deal with the different moodle form elements.
         $exception = new ElementNotFoundException($this->getSession(), '"' . $label . '" administration setting ');
         // The argument should be converted to an xpath literal.
         $label = behat_context_helper::escape($label);
         // Single element settings.
         try {
             $fieldxpath = "//*[self::input | self::textarea | self::select]" . "[not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]" . "[@id=//label[contains(normalize-space(.), {$label})]/@for or " . "@id=//span[contains(normalize-space(.), {$label})]/preceding-sibling::label[1]/@for]";
             $fieldnode = $this->find('xpath', $fieldxpath, $exception);
             $formfieldtypenode = $this->find('xpath', $fieldxpath . "/ancestor::div[contains(concat(' ', @class, ' '), ' form-setting ')]" . "/child::div[contains(concat(' ', @class, ' '),  ' form-')]/child::*/parent::div");
         } catch (ElementNotFoundException $e) {
             // Multi element settings, interacting only the first one.
             $fieldxpath = "//*[label[contains(., {$label})]|span[contains(., {$label})]]" . "/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" . "/descendant::div[contains(concat(' ', @class, ' '), ' form-group ')]" . "/descendant::*[self::input | self::textarea | self::select]" . "[not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]";
             $fieldnode = $this->find('xpath', $fieldxpath);
             // It is the same one that contains the type.
             $formfieldtypenode = $fieldnode;
         }
         // Getting the class which contains the field type.
         $classes = explode(' ', $formfieldtypenode->getAttribute('class'));
         $type = false;
         foreach ($classes as $class) {
             if (substr($class, 0, 5) == 'form-') {
                 $type = substr($class, 5);
             }
         }
         // Instantiating the appropiate field type.
         $field = behat_field_manager::get_field_instance($type, $fieldnode, $this->getSession());
         $field->set_value($value);
         $this->find_button(get_string('savechanges'))->press();
     }
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:48,代码来源:behat_theme_boost_behat_admin.php

示例12: i_open_folder_from_filemanager

 /**
  * Opens the contents of a filemanager folder. It looks for the folder in the current folder and in the path bar.
  *
  * @Given /^I open "(?P<foldername_string>(?:[^"]|\\")*)" folder from "(?P<filemanager_field_string>(?:[^"]|\\")*)" filemanager$/
  * @throws ExpectationException Thrown by behat_base::find
  * @param string $foldername
  * @param string $filemanagerelement
  */
 public function i_open_folder_from_filemanager($foldername, $filemanagerelement)
 {
     $fieldnode = $this->get_filepicker_node($filemanagerelement);
     $exception = new ExpectationException('The "' . $foldername . '" folder can not be found in the "' . $filemanagerelement . '" filemanager', $this->getSession());
     $folderliteral = behat_context_helper::escape($foldername);
     // We look both in the pathbar and in the contents.
     try {
         // In the current folder workspace.
         $folder = $this->find('xpath', "//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-folder ')]" . "/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' fp-filename ')]" . "[normalize-space(.)={$folderliteral}]", $exception, $fieldnode);
     } catch (ExpectationException $e) {
         // And in the pathbar.
         $folder = $this->find('xpath', "//a[contains(concat(' ', normalize-space(@class), ' '), ' fp-path-folder-name ')]" . "[normalize-space(.)={$folderliteral}]", $exception, $fieldnode);
     }
     // It should be a NodeElement, otherwise an exception would have been thrown.
     $folder->click();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:24,代码来源:behat_filepicker.php

示例13: i_enrol_user_as

 /**
  * Enrols the specified user in the current course without options.
  *
  * This is a simple step, to set enrolment options would be better to
  * create a separate step as a TableNode will be required.
  *
  * @Given /^I enrol "(?P<user_fullname_string>(?:[^"]|\\")*)" user as "(?P<rolename_string>(?:[^"]|\\")*)"$/
  * @param string $userfullname
  * @param string $rolename
  */
 public function i_enrol_user_as($userfullname, $rolename)
 {
     // Navigate to enrolment page.
     $parentnodes = get_string('courseadministration') . ' > ' . get_string('users', 'admin');
     $this->execute("behat_navigation::i_navigate_to_node_in", array(get_string('enrolledusers', 'enrol'), $parentnodes));
     $this->execute("behat_forms::press_button", get_string('enrolusers', 'enrol'));
     $this->execute('behat_forms::i_set_the_field_to', array(get_string('assignroles', 'role'), $rolename));
     if ($this->running_javascript()) {
         // We have a div here, not a tr.
         $userliteral = behat_context_helper::escape($userfullname);
         $userrowxpath = "//div[contains(concat(' ',normalize-space(@class),' '),' user ')][contains(., {$userliteral})]";
         $this->execute('behat_general::i_click_on_in_the', array(get_string('enrol', 'enrol'), "button", $userrowxpath, "xpath_element"));
         $this->execute("behat_forms::press_button", get_string('finishenrollingusers', 'enrol'));
     } else {
         $this->execute('behat_forms::i_set_the_field_to', array("addselect", $userfullname));
         $this->execute("behat_forms::press_button", "add");
     }
 }
开发者ID:reconnectmedia,项目名称:moodle,代码行数:28,代码来源:behat_enrol.php

示例14: i_should_see_grade_for_workshop_participant_set_by_peer

 /**
  * Checks that the user has particular grade set by his reviewing peer in workshop
  *
  * @Then /^I should see grade "(?P<grade_string>[^"]*)" for workshop participant "(?P<participant_name_string>(?:[^"]|\\")*)" set by peer "(?P<reviewer_name_string>(?:[^"]|\\")*)"$/
  * @param string $grade
  * @param string $participant
  * @param string $reviewer
  */
 public function i_should_see_grade_for_workshop_participant_set_by_peer($grade, $participant, $reviewer)
 {
     $participantliteral = behat_context_helper::escape($participant);
     $reviewerliteral = behat_context_helper::escape($reviewer);
     $gradeliteral = behat_context_helper::escape($grade);
     $participantselector = "contains(concat(' ', normalize-space(@class), ' '), ' participant ') " . "and contains(.,{$participantliteral})";
     $trxpath = "//table/tbody/tr[td[{$participantselector}]]";
     $tdparticipantxpath = "//table/tbody/tr/td[{$participantselector}]";
     $tdxpath = "/td[contains(concat(' ', normalize-space(@class), ' '), ' receivedgrade ') and contains(.,{$reviewerliteral})]/" . "descendant::span[contains(concat(' ', normalize-space(@class), ' '), ' grade ') and .={$gradeliteral}]";
     $tr = $this->find('xpath', $trxpath);
     $rowspan = $this->find('xpath', $tdparticipantxpath)->getAttribute('rowspan');
     $xpath = $trxpath . $tdxpath;
     if (!empty($rowspan)) {
         for ($i = 1; $i < $rowspan; $i++) {
             $xpath .= ' | ' . $trxpath . "/following-sibling::tr[{$i}]" . $tdxpath;
         }
     }
     $this->find('xpath', $xpath);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:27,代码来源:behat_mod_workshop.php

示例15: get_criterion_xpath

 /**
  * Returns the xpath representing the selected criterion.
  *
  * It is the xpath when grading a rubric or viewing a rubric,
  * it is not the same xpath when editing a rubric.
  *
  * @param string $criterionname Literal including the criterion name.
  * @return string
  */
 protected function get_criterion_xpath($criterionname)
 {
     $literal = behat_context_helper::escape($criterionname);
     return "//tr[contains(concat(' ', normalize-space(@class), ' '), ' criterion ')]" . "[./descendant::td[@class='description'][text()={$literal}]]";
 }
开发者ID:evltuma,项目名称:moodle,代码行数:14,代码来源:behat_gradingform_rubric.php


注:本文中的behat_context_helper::escape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。