@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace samsonframework\behatextension; |
| 6 | 6 | |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | $backtrace = debug_backtrace(); |
| 90 | 90 | |
| 91 | 91 | throw new \Exception( |
| 92 | - 'Timeout thrown by '.$backtrace[1]['class'].'::'.$backtrace[1]['function']."()\n" |
|
| 93 | - .(array_key_exists('file', $backtrace[1]) ? $backtrace[1]['file'].', line '.$backtrace[1]['line'] : '')."\n" |
|
| 92 | + 'Timeout thrown by ' . $backtrace[1]['class'] . '::' . $backtrace[1]['function'] . "()\n" |
|
| 93 | + .(array_key_exists('file', $backtrace[1]) ? $backtrace[1]['file'] . ', line ' . $backtrace[1]['line'] : '') . "\n" |
|
| 94 | 94 | .implode("\n", $failedExceptions) |
| 95 | 95 | ); |
| 96 | 96 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $step = $scope->getStep(); |
| 113 | - $fileName = 'Fail.'.preg_replace('/[^a-zA-Z0-9-_\.]/', '_', $scope->getName().'-'.$step->getText()).'.jpg'; |
|
| 113 | + $fileName = 'Fail.' . preg_replace('/[^a-zA-Z0-9-_\.]/', '_', $scope->getName() . '-' . $step->getText()) . '.jpg'; |
|
| 114 | 114 | file_put_contents($fileName, $driver->getScreenshot()); |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $elements = []; |
| 130 | 130 | |
| 131 | - $this->spin(function (MinkContext $context) use ($selector, &$elements) { |
|
| 131 | + $this->spin(function(MinkContext $context) use ($selector, &$elements) { |
|
| 132 | 132 | $session = $context->getSession(); |
| 133 | 133 | |
| 134 | 134 | $elements = $session->getPage()->findAll('css', $context->fixStepArgument($selector)); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function iSetBrowserWindowSizeToX($width, $height) |
| 169 | 169 | { |
| 170 | - $this->getSession()->resizeWindow((int) $width, (int) $height, 'current'); |
|
| 170 | + $this->getSession()->resizeWindow((int)$width, (int)$height, 'current'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function iWaitMillisecondsForResponse($delay = self::DELAY) |
| 179 | 179 | { |
| 180 | - $this->getSession()->wait((int) $delay); |
|
| 180 | + $this->getSession()->wait((int)$delay); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param string $page Page for assertion |
| 205 | 205 | */ |
| 206 | 206 | public function assertPageAddress($page) { |
| 207 | - $this->spin(function (MinkContext $context) use ($page) { |
|
| 207 | + $this->spin(function(MinkContext $context) use ($page) { |
|
| 208 | 208 | $context->assertSession()->addressEquals($this->locatePath($page)); |
| 209 | 209 | return true; |
| 210 | 210 | }); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function iScrollVerticallyToPx($yPos) |
| 246 | 246 | { |
| 247 | - $this->getSession()->executeScript('window.scrollTo(0, Math.min(document.documentElement.scrollHeight, document.body.scrollHeight, '.((int) $yPos).'));'); |
|
| 247 | + $this->getSession()->executeScript('window.scrollTo(0, Math.min(document.documentElement.scrollHeight, document.body.scrollHeight, ' . ((int)$yPos) . '));'); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function iScrollHorizontallyToPx($xPos) |
| 256 | 256 | { |
| 257 | - $this->getSession()->executeScript('window.scrollTo('.((int) $xPos).', 0);'); |
|
| 257 | + $this->getSession()->executeScript('window.scrollTo(' . ((int)$xPos) . ', 0);'); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | { |
| 268 | 268 | // TODO: Change to Mink implementation |
| 269 | 269 | $this->getSession()->executeScript(" |
| 270 | - $('input[name=".$field."]').val('".$value."'); |
|
| 270 | + $('input[name=".$field . "]').val('" . $value . "'); |
|
| 271 | 271 | "); |
| 272 | 272 | } |
| 273 | 273 | |
@@ -317,6 +317,6 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public function iFillInTheElementUsingJs(string $selector, string $value) |
| 319 | 319 | { |
| 320 | - $this->getSession()->executeScript('document.querySelectorAll("'.$selector.'")[0].value="'.$value.'";'); |
|
| 320 | + $this->getSession()->executeScript('document.querySelectorAll("' . $selector . '")[0].value="' . $value . '";'); |
|
| 321 | 321 | } |
| 322 | 322 | } |