Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Load default migrations for this package if DX decides not to publish/modify them. #31

Merged
merged 2 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/Console/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ class Install extends Command
*/
public function handle()
{
if (! class_exists('CreateBasePaymentTables')) {
$this->call('vendor:publish', ['--provider' => 'Payavel\Checkout\PaymentServiceProvider', '--tag' => 'payavel-migrations']);
}

$this->installProviders();

$this->installMerchants();
Expand Down
19 changes: 11 additions & 8 deletions src/PaymentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ class PaymentServiceProvider extends ServiceProvider
{
public function boot()
{
if (! $this->app->runningInConsole()) {
return;
}

$this->registerPublishableAssets();

$this->registerCommands();

$this->registerMigrations();
}

public function register()
Expand All @@ -29,10 +35,6 @@ public function register()

protected function registerPublishableAssets()
{
if (! $this->app->runningInConsole()) {
return;
}

$this->publishes([
__DIR__ . '/database/migrations/2021_01_01_000000_create_base_payment_tables.php' => database_path('migrations/2021_01_01_000000_create_base_payment_tables.php'),
], 'payavel-migrations');
Expand All @@ -44,13 +46,14 @@ protected function registerPublishableAssets()

protected function registerCommands()
{
if (! $this->app->runningInConsole()) {
return;
}

$this->commands([
MakeProvider::class,
Install::class,
]);
}

protected function registerMigrations()
{
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
}
}
14 changes: 0 additions & 14 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@ protected function getEnvironmentSetUp($app)
]);
}

/**
* Perform any work that should take place once the database has finished refreshing.
*
* @return void
*/
protected function afterRefreshingDatabase()
{
if (! class_exists('CreateBasePaymentTables')) {
$this->artisan('vendor:publish', ['--provider' => 'Payavel\Checkout\PaymentServiceProvider', '--tag' => 'payavel-migrations']);

$this->artisan('migrate');
}
}

/**
* Setup the test environment.
*
Expand Down
17 changes: 0 additions & 17 deletions tests/Unit/BillableTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,6 @@

class BillableTraitTest extends TestCase
{
/**
* Setup the test environment.
*
* @return void
*/
protected function setUp(): void
{
parent::setUp();

$this->artisan('vendor:publish', [
'--provider' => 'Payavel\\Checkout\\PaymentServiceProvider',
'--tag' => 'payavel-migrations'
]);

$this->artisan('migrate');
}

/** @test */
public function retrieve_billable_wallets()
{
Expand Down