Ejemplo n.º 1
0
 /**
  * Gets an instance of the form field from it's label
  *
  * @param string $label
  * @param RawMinkContext $context
  * @return behat_form_field
  */
 public static function get_form_field_from_label($label, RawMinkContext $context)
 {
     // There are moodle form elements that are not directly related with
     // a basic HTML form field, we should also take care of them.
     // The DOM node.
     $fieldnode = $context->find_field($label);
     // The behat field manager.
     return self::get_form_field($fieldnode, $context->getSession());
 }
Ejemplo n.º 2
0
 /**
  * Gets an instance of the form field from it's label
  *
  * @param string $label
  * @param RawMinkContext $context
  * @return behat_form_field
  */
 public static function get_form_field_from_label($label, RawMinkContext $context)
 {
     // There are moodle form elements that are not directly related with
     // a basic HTML form field, we should also take care of them.
     try {
         // The DOM node.
         $fieldnode = $context->find_field($label);
     } catch (ElementNotFoundException $fieldexception) {
         // Looking for labels that points to filemanagers.
         try {
             $fieldnode = $context->find_filemanager($label);
         } catch (ElementNotFoundException $filemanagerexception) {
             // We want the generic 'field' exception.
             throw $fieldexception;
         }
     }
     // The behat field manager.
     return self::get_form_field($fieldnode, $context->getSession());
 }