Example #1
0
 public static function match($actual, $expected)
 {
     self::$_description = ['description' => "to have an element found by the expected selector.", 'params' => ['actual' => $actual, 'expected' => "an element matching '{$expected}'"]];
     if ($actual instanceof ElementNotFound) {
         self::$_description['params']['actual'] = (string) $actual;
         return false;
     }
     if (!$actual instanceof Element) {
         $repr = Str::toString($actual);
         throw new \Exception("Not a valid Mink DOM Element: {$repr}");
     }
     return $actual->find(probable_expression_type($expected), $expected) !== null;
 }
Example #2
0
/**
 * @param string $selector
 * @param Element $parent
 * @return NodeElement[]
 */
function elements($selector, Element $parent = null)
{
    $parent = $parent ?: page();
    return $parent->findAll(probable_expression_type($selector), $selector);
}