You are here

public function TestSubContext::getRegion in Drupal Commons 7.3

Get a region by name.

Parameters

string $region: The name of the region from the behat.yml file.

Return value

Behat\Mink\Element\Element An element representing the region.

6 calls to TestSubContext::getRegion()
TestSubContext::assertAltRegion in tests/steps/commons_test.behat.inc
@Then /^I should see the image alt "(?P<text>(?:[^"]|\\")*)" in the "(?P<region>[^"]*)" region$/
TestSubContext::assertNotRegionElementTextAttribute in tests/steps/commons_test.behat.inc
@Then I should not see :text in the :tag element with the :attribute attribute set to :value in the :region region
TestSubContext::assertNotRegionMatchesText in tests/steps/commons_test.behat.inc
Asserts that the region does not contain text matching specified pattern.
TestSubContext::assertRegionElementText in tests/steps/commons_test.behat.inc
@Then I should see :text in the :tag element in the :region region
TestSubContext::assertRegionMatchesText in tests/steps/commons_test.behat.inc
Asserts that the region contains text matching specified pattern.

... See full list

File

tests/steps/commons_test.behat.inc, line 67
Provide Behat step-definitions for generic Commons tests.

Class

TestSubContext

Code

public function getRegion($region) {
  $session = $this
    ->getSession();
  $regionObj = $session
    ->getPage()
    ->find('region', $region);
  if (!$regionObj) {
    throw new \Exception(sprintf('No region "%s" found on the page %s.', $region, $session
      ->getCurrentUrl()));
  }
  return $regionObj;
}