diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-05-04 12:35:01 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-05-06 12:37:55 +0200 |
commit | 7642a4b72746838f50ff0fc1eba2320fb63d1660 (patch) | |
tree | 704a7ecae48f4c2f912dd8accae0fdae91e83670 /tests | |
parent | 16e3e816352d8afc46db82fa85c2bf776a4d7fdd (diff) | |
download | nextcloud-server-7642a4b72746838f50ff0fc1eba2320fb63d1660.tar.gz nextcloud-server-7642a4b72746838f50ff0fc1eba2320fb63d1660.zip |
Make internal find methods static
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/acceptance/features/core/Actor.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/acceptance/features/core/Actor.php b/tests/acceptance/features/core/Actor.php index fdb15aa946a..d5987f4e848 100644 --- a/tests/acceptance/features/core/Actor.php +++ b/tests/acceptance/features/core/Actor.php @@ -165,22 +165,22 @@ class Actor { public function find(Locator $elementLocator, $timeout = 0, $timeoutStep = 0.5) { $timeout = $timeout * $this->findTimeoutMultiplier; - return $this->findInternal($elementLocator, $timeout, $timeoutStep); + return self::findInternal($this->session, $elementLocator, $timeout, $timeoutStep); } /** - * Finds an element in the Mink Session of this Actor. + * Finds an element in the given Mink Session. * * The timeout is not affected by the multiplier set using * setFindTimeoutMultiplier(). * - * @see find($elementLocator, $timeout, $timeoutStep) + * @see find($session, $elementLocator, $timeout, $timeoutStep) */ - private function findInternal(Locator $elementLocator, $timeout, $timeoutStep) { + private static function findInternal(\Behat\Mink\Session $session, Locator $elementLocator, $timeout, $timeoutStep) { $element = null; $selector = $elementLocator->getSelector(); $locator = $elementLocator->getLocator(); - $ancestorElement = $this->findAncestorElement($elementLocator, $timeout, $timeoutStep); + $ancestorElement = self::findAncestorElement($session, $elementLocator, $timeout, $timeoutStep); $findCallback = function() use (&$element, $selector, $locator, $ancestorElement) { $element = $ancestorElement->find($selector, $locator); @@ -210,6 +210,8 @@ class Actor { * The timeout is used only when finding the element for the ancestor * locator; if the timeout expires a NoSuchElementException is thrown. * + * @param \Behat\Mink\Session $session the Mink Session to get the ancestor + * element from. * @param Locator $elementLocator the locator for the element to get its * ancestor. * @param float $timeout the number of seconds (decimals allowed) to wait at @@ -219,11 +221,11 @@ class Actor { * @return \Behat\Mink\Element\Element the ancestor element found. * @throws NoSuchElementException if the ancestor element can not be found. */ - private function findAncestorElement(Locator $elementLocator, $timeout, $timeoutStep) { + private static function findAncestorElement(\Behat\Mink\Session $session, Locator $elementLocator, $timeout, $timeoutStep) { $ancestorElement = $elementLocator->getAncestor(); if ($ancestorElement instanceof Locator) { try { - $ancestorElement = $this->findInternal($ancestorElement, $timeout, $timeoutStep); + $ancestorElement = self::findInternal($session, $ancestorElement, $timeout, $timeoutStep); } catch (NoSuchElementException $exception) { // Little hack to show the stack of ancestor elements that could // not be found, as Behat only shows the message of the last @@ -238,7 +240,7 @@ class Actor { } if ($ancestorElement === null) { - $ancestorElement = $this->getSession()->getPage(); + $ancestorElement = $session->getPage(); } return $ancestorElement; |