ClientTestCase |
---|
assert ($fail_message = '') |
assertContentType ($expected_type) |
assertElementAttributeNotEmpty ($attribute, $css_selector, $index = 0) |
assertElementExists ($css_selector, $failure_message = '') |
assertElementNotEmpty ($css_selector, $index = 0) |
assertElementNotExists ($css_selector, $failure_message = '') |
assertElementNotVisible ($css_selector, $failure_message = '') |
assertElementRegExp ($expected, $css_selector, $index = 0) |
assertElementSame ($expected, $css_selector, $index = 0) |
assertElementVisible ($css_selector, $failure_message = '') |
assertMetaTagSame ($expected, $name, $attribute) |
assertResponseIsAjaxCommands (GuzzleHttp\Psr7\Response or NULL $response = NULL) |
assertResponseMatchesSchema ($schema_filename, GuzzleHttp\Psr7\Response or NULL $response = NULL) |
assertUrlContentTypeEquals ($content_type, $url) |
assertUrlNotSame ($expected) |
assertUrlRedirectsTo ($final_url, $url) |
assertUrlSame ($expected) |
assertUrlStatusCodeEquals ($status_code, $url, $message = '') |
assertUrlStatusCodeNotEquals ($status_code, $url) |
el ($css_selector, $limit_to_one = true) |
els ($css_selector) |
emptyCookieJar () |
generate ($method) |
getClient (array $options = Array) |
getCookieJar () |
getDomElements (array $css_selectors) |
getDrupalCommandsClient () |
getHtmlClient () |
getJsonClient () |
getResponse () |
getSession () |
getStored ($key, $default = NULL) |
getXmlClient () |
handleBaseUrl () |
loadJsonByUrl ($url) |
loadPageByUrl ($url) |
loadXmlByUrl ($url) |
onAfterLastTest () |
onBeforeFirstTest () |
requestThenAssert (callable $callback, $url, array $client_options = Array, $method = 'HEAD', callable or NULL $on_fail = NULL) |
resolveUrl ($url, $remove_authentication_credentials = false) |
store ($key, $value) |
There is some overlap in assertions between methods of
ClientTestCase
and methods on Mink'sWebAssert
class, but the former always uses css selectors, so it's a little less verbose.
DocumentElement
objectsLearn more here.
DocumentElement |
---|
attachFileToField ($locator, $path) |
checkField ($locator) |
clickLink ($locator) |
elementNotFound ($type, $selector = NULL, $locator = NULL) |
fillField ($locator, $value) |
find ($selector, $locator) |
findAll ($selector, $locator) |
findButton ($locator) |
findById ($id) |
findField ($locator) |
findLink ($locator) |
getContent () |
getDriver () |
getHtml () |
getOuterHtml () |
getSelectorsHandler () |
getSession () |
getText () |
getXpath () |
has ($selector, $locator) |
hasButton ($locator) |
hasCheckedField ($locator) |
hasContent ($content) |
hasField ($locator) |
hasLink ($locator) |
hasSelect ($locator) |
hasTable ($locator) |
hasUncheckedField ($locator) |
isValid () |
pressButton ($locator) |
selectFieldOption ($locator, $value, $multiple = false) |
uncheckField ($locator) |
waitFor ($timeout, $callback) |
NodeElement
objectsLearn more here.
<?php
class Test {
public function testExample() {
// By using getDomElements we ensure only one of .t-link.
$el = $this->loadPageByUrl('/node/9750')
->getDomElements([
'.t-link',
]);
// $el['.t-link'] is an instance of NodeElement.
$el['.t-link']->click();
// Altenatively you could do this.
$this->el('.t-link')->click()
}
}
NodeElement |
---|
attachFile ($path) |
attachFileToField ($locator, $path) |
blur () |
check () |
checkField ($locator) |
click () |
clickLink ($locator) |
doubleClick () |
dragTo (Behat\Mink\Element\ElementInterface $destination) |
elementNotFound ($type, $selector = NULL, $locator = NULL) |
fillField ($locator, $value) |
find ($selector, $locator) |
findAll ($selector, $locator) |
findButton ($locator) |
findById ($id) |
findField ($locator) |
findLink ($locator) |
focus () |
getAttribute ($name) |
getDriver () |
getHtml () |
getOuterHtml () |
getParent () |
getSelectorsHandler () |
getSession () |
getTagName () |
getText () |
getValue () |
getXpath () |
has ($selector, $locator) |
hasAttribute ($name) |
hasButton ($locator) |
hasCheckedField ($locator) |
hasClass ($className) |
hasField ($locator) |
hasLink ($locator) |
hasSelect ($locator) |
hasTable ($locator) |
hasUncheckedField ($locator) |
isChecked () |
isSelected () |
isValid () |
isVisible () |
keyDown ($char, $modifier = NULL) |
keyPress ($char, $modifier = NULL) |
keyUp ($char, $modifier = NULL) |
mouseOver () |
press () |
pressButton ($locator) |
rightClick () |
selectFieldOption ($locator, $value, $multiple = false) |
selectOption ($option, $multiple = false) |
setValue ($value) |
submit () |
uncheck () |
uncheckField ($locator) |
waitFor ($timeout, $callback) |
Load a page and then make assertions using Mink's WebAssert class.
<?php
class Test {
public function testExample() {
$this->loadPageByUrl('/node/9750')
->assert()
->elementTextContains('css', '#button', 'English');
$this->assert()
->elementTextContains('css', '#button-2', 'Spanish');
}
}
WebAssert |
---|
addressEquals ($page) |
addressMatches ($regex) |
addressNotEquals ($page) |
assert ($condition, $message) |
assertElement ($condition, $message, Behat\Mink\Element\Element $element) |
assertElementText ($condition, $message, Behat\Mink\Element\Element $element) |
assertResponseText ($condition, $message) |
checkboxChecked ($field, Behat\Mink\Element\TraversableElement or NULL $container = NULL) |
checkboxNotChecked ($field, Behat\Mink\Element\TraversableElement or NULL $container = NULL) |
cleanUrl ($url) |
cookieEquals ($name, $value) |
cookieExists ($name) |
elementAttributeContains ($selectorType, $selector, $attribute, $text) |
elementAttributeExists ($selectorType, $selector, $attribute) |
elementAttributeNotContains ($selectorType, $selector, $attribute, $text) |
elementContains ($selectorType, $selector, $html) |
elementExists ($selectorType, $selector, Behat\Mink\Element\ElementInterface or NULL $container = NULL) |
elementNotContains ($selectorType, $selector, $html) |
elementNotExists ($selectorType, $selector, Behat\Mink\Element\ElementInterface or NULL $container = NULL) |
elementsCount ($selectorType, $selector, $count, Behat\Mink\Element\ElementInterface or NULL $container = NULL) |
elementTextContains ($selectorType, $selector, $text) |
elementTextNotContains ($selectorType, $selector, $text) |
fieldExists ($field, Behat\Mink\Element\TraversableElement or NULL $container = NULL) |
fieldNotExists ($field, Behat\Mink\Element\TraversableElement or NULL $container = NULL) |
fieldValueEquals ($field, $value, Behat\Mink\Element\TraversableElement or NULL $container = NULL) |
fieldValueNotEquals ($field, $value, Behat\Mink\Element\TraversableElement or NULL $container = NULL) |
getCurrentUrlPath () |
getMatchingElementRepresentation ($selectorType, $selector, $plural = false) |
pageTextContains ($text) |
pageTextMatches ($regex) |
pageTextNotContains ($text) |
pageTextNotMatches ($regex) |
responseContains ($text) |
responseHeaderContains ($name, $value) |
responseHeaderEquals ($name, $value) |
responseHeaderMatches ($name, $regex) |
responseHeaderNotContains ($name, $value) |
responseHeaderNotEquals ($name, $value) |
responseHeaderNotMatches ($name, $regex) |
responseMatches ($regex) |
responseNotContains ($text) |
responseNotMatches ($regex) |
statusCodeEquals ($code) |
statusCodeNotEquals ($code) |