-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
731 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,53 @@ | ||
{ | ||
"name": "leeovery/laravel-playwright", | ||
"description": "Backend stuff for Playwright e2e tests", | ||
"keywords": [ | ||
"leeovery", | ||
"laravel-playwright" | ||
], | ||
"homepage": "https://github.com/leeovery/laravel-playwright", | ||
"license": "MIT", | ||
"type": "library", | ||
"authors": [ | ||
{ | ||
"name": "Lee Overy", | ||
"email": "me@leeovery.com", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"illuminate/support": "^v9.0.2", | ||
"spatie/laravel-package-tools": "^1.13" | ||
}, | ||
"require-dev": { | ||
"laravel/pint": "^1.3", | ||
"orchestra/testbench": "^v7.0", | ||
"phpunit/phpunit": "^9.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Leeovery\\LaravelPlaywright\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Leeovery\\LaravelPlaywright\\Tests\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vendor/bin/phpunit", | ||
"test-coverage": "vendor/bin/phpunit --coverage-html coverage" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Leeovery\\LaravelPlaywright\\LaravelPlaywrightServiceProvider" | ||
] | ||
} | ||
"name": "leeovery/laravel-playwright", | ||
"description": "Backend stuff for Playwright e2e tests", | ||
"keywords": [ | ||
"leeovery", | ||
"laravel-playwright" | ||
], | ||
"homepage": "https://github.com/leeovery/laravel-playwright", | ||
"license": "MIT", | ||
"type": "library", | ||
"authors": [ | ||
{ | ||
"name": "Lee Overy", | ||
"email": "me@leeovery.com", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.2", | ||
"illuminate/support": "^v9.0.2|^10.0", | ||
"spatie/laravel-package-tools": "^1.14", | ||
"ext-pdo": "*" | ||
}, | ||
"require-dev": { | ||
"laravel/pint": "^1.4", | ||
"orchestra/testbench": "^v7.0|v8.0", | ||
"phpunit/phpunit": "^9.3" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Leeovery\\LaravelPlaywright\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Leeovery\\LaravelPlaywright\\Tests\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vendor/bin/phpunit", | ||
"test-coverage": "vendor/bin/phpunit --coverage-html coverage" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Leeovery\\LaravelPlaywright\\LaravelPlaywrightServiceProvider" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace Leeovery\LaravelPlaywright\Commands\Database; | ||
|
||
use Illuminate\Console\Command; | ||
use Leeovery\LaravelPlaywright\Commands\Database\Connectors\Connector; | ||
use Leeovery\LaravelPlaywright\Commands\Database\Connectors\DryRunConnector; | ||
use Leeovery\LaravelPlaywright\Commands\Database\Connectors\PDOConnector; | ||
use Leeovery\LaravelPlaywright\Commands\Database\Schema\Builder; | ||
use Leeovery\LaravelPlaywright\Commands\Database\Schema\GrammarFactory; | ||
|
||
abstract class AbstractDatabaseCommand extends Command | ||
{ | ||
protected array $config = []; | ||
|
||
protected function showIfPretendMode() | ||
{ | ||
if ($this->isPretendRunMode()) { | ||
$this->info('[PRETENDING] Running in pretend mode.'); | ||
} | ||
} | ||
|
||
protected function isPretendRunMode(): bool | ||
{ | ||
return (bool) $this->option('pretend'); | ||
} | ||
|
||
protected function createBuilder(): Builder | ||
{ | ||
return new Builder( | ||
$this->makeConnector(), | ||
resolve(GrammarFactory::class) | ||
); | ||
} | ||
|
||
protected function makeConnector(): Connector | ||
{ | ||
if ($this->isPretendRunMode()) { | ||
return new DryRunConnector($this->output); | ||
} | ||
|
||
return PDOConnector::make($this->getConfig()); | ||
} | ||
|
||
protected function getConfig(string $key = null): mixed | ||
{ | ||
if (! $this->config) { | ||
$connection = $this->option('connection') ?? config('database.default'); | ||
$this->config = config(sprintf('database.connections.%s', $connection)); | ||
$this->config['database'] = $this->option('database') ?? $this->config['database']; | ||
} | ||
|
||
return $key ? $this->config[$key] : $this->config; | ||
} | ||
} |
Oops, something went wrong.