From f147cc8a3a68d2b013c0414af7e0f22c8af78612 Mon Sep 17 00:00:00 2001 From: Jelle Kok Date: Sat, 31 Mar 2018 13:56:33 +0200 Subject: [PATCH] Add windows support * still does not run --- src/Task/Test/TestRunSelenium.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Task/Test/TestRunSelenium.php b/src/Task/Test/TestRunSelenium.php index 05ae56d..4d57d0a 100644 --- a/src/Task/Test/TestRunSelenium.php +++ b/src/Task/Test/TestRunSelenium.php @@ -31,10 +31,16 @@ public function run() $this->printTaskInfo('Starting Selenium (' . $this->seleniumFolder . ') with ' . $this->webDriver . ' (OS: ' . \PHP_OS . ')'); $webDriverPath = $this->buildWebDriverPath(); - // Execute the task - $this->collectionBuilder()->taskExec('PATH="$PATH:' . $webDriverPath . '" java -jar ' . $this->seleniumFolder . - '/bin/selenium-server-standalone.jar >> selenium.log 2>&1 &')->run(); + if (!$this->isWindows()) + { + $this->collectionBuilder()->taskExec('PATH="$PATH:' . $webDriverPath . '" java -jar ' . $this->seleniumFolder . + '/bin/selenium-server-standalone.jar >> selenium.log 2>&1 &')->run(); + + return; + } + $this->collectionBuilder()->taskExec('PATH="$PATH:' . $webDriverPath . '" START java.exe -jar ' . $this->seleniumFolder . + '/bin/selenium-server-standalone.jar')->run(); } /** @@ -79,4 +85,14 @@ protected function getOsFolderName() { return self::$osFolder[$this->getOs()]; } + + /** + * Check if local OS is Windows + * + * @return bool + */ + private function isWindows() + { + return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; + } }