Skip to content

Commit

Permalink
- bump dependencies
Browse files Browse the repository at this point in the history
- fix deprecated exception catching
- allow config file to be published
- skip registration if not running tests
  • Loading branch information
skylerkatz committed Mar 21, 2023
1 parent 5d644d6 commit abf3efd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"ext-zip": "*",
"illuminate/support": "9.*|10.*|dev-master",
"nyholm/psr7": "^1.5",
"php-webdriver/webdriver": "^1.12",
"react/http": "^1.7",
"php-webdriver/webdriver": "^1.14",
"react/http": "^1.8",
"symfony/psr-http-message-bridge": "^2.1"
},
"require-dev": {
Expand All @@ -34,8 +34,7 @@
},
"autoload": {
"psr-4": {
"Glhd\\Dawn\\": "src/",
"Laravel\\Dusk\\": "dusk/"
"Glhd\\Dawn\\": "src/"
}
},
"autoload-dev": {
Expand Down
4 changes: 2 additions & 2 deletions src/Browser/BrowserManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Closure;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Exception\WebDriverCurlException;
use Facebook\WebDriver\Exception\PhpWebDriverExceptionInterface;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverElement;
Expand Down Expand Up @@ -73,7 +73,7 @@ protected function newBrowserConnection(bool $autostart = true): RemoteWebDriver
{
try {
return call_user_func($this->connector, $this);
} catch (WebDriverCurlException $exception) {
} catch (PhpWebDriverExceptionInterface $exception) {
// If we've already tried to auto-start, then just fail
if (! $autostart || $this->driver_process) {
throw new WebDriverNotRunningException($exception);
Expand Down
14 changes: 14 additions & 0 deletions src/Providers/DawnServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class DawnServiceProvider extends ServiceProvider
public function register()
{
$this->mergeConfigFrom(__DIR__.'/../../config/dawn.php', 'dawn');

if (! $this->app->runningUnitTests()) {
return;
}

$this->app->singleton('dawn.loop', function() {
return Loop::get();
Expand Down Expand Up @@ -74,6 +78,11 @@ public function register()

public function boot()
{
$this->publishes(
[$this->packageConfigFile() => $this->app->configPath('dawn.php')],
['dawn', 'dawn-config']
);

Blade::directive('dawnTarget', function($expression) {
return App::runningUnitTests()
? '<?php echo \' data-dawn-target="\'.e((string) '.$expression.').\'" \'; ?>'
Expand Down Expand Up @@ -109,4 +118,9 @@ protected function seleniumPort(): int

return 9515;
}

protected function packageConfigFile(): string
{
return dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'dawn.php';
}
}

0 comments on commit abf3efd

Please sign in to comment.