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

[15.x] Stops using loadMigrationsFrom #1613

Merged
merged 3 commits into from
Dec 12, 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
10 changes: 10 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Upgrade Guide

## Upgrading To 15.0 From 14.x

### Migration Changes

Cashier 15.0 no longer automatically loads migrations from its own migrations directory. Instead, you should run the following command to publish Cashier's migrations to your application:

```bash
php artisan vendor:publish --tag=cashier-migrations
```

## Upgrading To 14.12.2 From 14.12

### Webhook Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"require-dev": {
"dompdf/dompdf": "^2.0",
"mockery/mockery": "^1.0",
"orchestra/testbench": "^7.0|^8.0",
"orchestra/testbench": "^7.14|^8.14",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.0"
},
Expand Down
19 changes: 0 additions & 19 deletions src/Cashier.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ class Cashier
*/
protected static $formatCurrencyUsing;

/**
* Indicates if Cashier migrations will be run.
*
* @var bool
*/
public static $runsMigrations = true;

/**
* Indicates if Cashier routes will be registered.
*
Expand Down Expand Up @@ -173,18 +166,6 @@ public static function formatAmount($amount, $currency = null, $locale = null, a
return $moneyFormatter->format($money);
}

/**
* Configure Cashier to not register its migrations.
*
* @return static
*/
public static function ignoreMigrations()
{
static::$runsMigrations = false;

return new static;
}

/**
* Configure Cashier to not register its routes.
*
Expand Down
13 changes: 0 additions & 13 deletions src/CashierServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public function boot()
$this->registerLogger();
$this->registerRoutes();
$this->registerResources();
$this->registerMigrations();
$this->registerPublishing();
$this->registerCommands();

Expand Down Expand Up @@ -123,18 +122,6 @@ protected function registerResources()
$this->loadViewsFrom(__DIR__.'/../resources/views', 'cashier');
}

/**
* Register the package migrations.
*
* @return void
*/
protected function registerMigrations()
{
if (Cashier::$runsMigrations && $this->app->runningInConsole()) {
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
}
}

/**
* Register the package's publishable resources.
*
Expand Down
5 changes: 5 additions & 0 deletions testbench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
providers:
- Laravel\Cashier\CashierServiceProvider

migrations:
- database/migrations
8 changes: 2 additions & 6 deletions tests/Feature/FeatureTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
use Laravel\Cashier\Cashier;
use Laravel\Cashier\Tests\Fixtures\User;
use Laravel\Cashier\Tests\TestCase;
use Orchestra\Testbench\Concerns\WithLaravelMigrations;
use Stripe\ApiRequestor as StripeApiRequestor;
use Stripe\HttpClient\CurlClient as StripeCurlClient;
use Stripe\StripeClient;

abstract class FeatureTestCase extends TestCase
{
use RefreshDatabase;
use RefreshDatabase, WithLaravelMigrations;

protected function setUp(): void
{
Expand All @@ -27,11 +28,6 @@ protected function setUp(): void
StripeApiRequestor::setHttpClient($curl);
}

protected function defineDatabaseMigrations()
{
$this->loadLaravelMigrations();
}

protected static function stripe(array $options = []): StripeClient
{
return Cashier::stripe(array_merge(['api_key' => getenv('STRIPE_SECRET')], $options));
Expand Down
9 changes: 3 additions & 6 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
use Illuminate\Support\Str;
use InvalidArgumentException;
use Laravel\Cashier\Cashier;
use Laravel\Cashier\CashierServiceProvider;
use Laravel\Cashier\Tests\Fixtures\User;
use Orchestra\Testbench\Concerns\WithWorkbench;
use Orchestra\Testbench\TestCase as OrchestraTestCase;

abstract class TestCase extends OrchestraTestCase
{
use WithWorkbench;

protected function getEnvironmentSetUp($app)
{
$apiKey = config('cashier.secret');
Expand All @@ -21,9 +23,4 @@ protected function getEnvironmentSetUp($app)

Cashier::useCustomerModel(User::class);
}

protected function getPackageProviders($app)
{
return [CashierServiceProvider::class];
}
}