mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-28 19:10:40 +00:00
added it_store_stripe_plans_via_setup_wizard test
This commit is contained in:
@@ -14,7 +14,6 @@ use App\Services\SetupService;
|
|||||||
use App\Services\StripeService;
|
use App\Services\StripeService;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\UserSettings;
|
|
||||||
use Artisan;
|
use Artisan;
|
||||||
use Cartalyst\Stripe\Exception\UnauthorizedException;
|
use Cartalyst\Stripe\Exception\UnauthorizedException;
|
||||||
use Doctrine\DBAL\Driver\PDOException;
|
use Doctrine\DBAL\Driver\PDOException;
|
||||||
@@ -24,7 +23,6 @@ use Illuminate\Support\Facades\Auth;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Schema;
|
use Schema;
|
||||||
use Stripe;
|
use Stripe;
|
||||||
@@ -236,12 +234,15 @@ class SetupWizardController extends Controller
|
|||||||
* Create Stripe subscription plan
|
* Create Stripe subscription plan
|
||||||
*
|
*
|
||||||
* @param StoreStripePlansRequest $request
|
* @param StoreStripePlansRequest $request
|
||||||
|
* @return \Illuminate\Contracts\Foundation\Application|ResponseFactory|\Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function store_stripe_plans(StoreStripePlansRequest $request)
|
public function store_stripe_plans(StoreStripePlansRequest $request)
|
||||||
{
|
{
|
||||||
foreach ($request->input('plans') as $plan) {
|
foreach ($request->plans as $plan) {
|
||||||
$this->stripe->createPlan($plan);
|
$this->stripe->createPlan($plan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return response('Done', 204);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -299,12 +300,12 @@ class SetupWizardController extends Controller
|
|||||||
// Store credentials for mail
|
// Store credentials for mail
|
||||||
// TODO: add options for mailgun
|
// TODO: add options for mailgun
|
||||||
setEnvironmentValue([
|
setEnvironmentValue([
|
||||||
'MAIL_DRIVER' => $request->input('mail.driver'),
|
'MAIL_DRIVER' => $request->mail['driver'],
|
||||||
'MAIL_HOST' => $request->input('mail.host'),
|
'MAIL_HOST' => $request->mail['host'],
|
||||||
'MAIL_PORT' => $request->input('mail.port'),
|
'MAIL_PORT' => $request->mail['port'],
|
||||||
'MAIL_USERNAME' => $request->input('mail.username'),
|
'MAIL_USERNAME' => $request->mail['username'],
|
||||||
'MAIL_PASSWORD' => $request->input('mail.password'),
|
'MAIL_PASSWORD' => $request->mail['password'],
|
||||||
'MAIL_ENCRYPTION' => $request->input('mail.encryption'),
|
'MAIL_ENCRYPTION' => $request->mail['encryption'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Artisan::call('config:cache');
|
Artisan::call('config:cache');
|
||||||
@@ -451,7 +452,7 @@ class SetupWizardController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Get setup wizard status
|
* Get setup wizard status
|
||||||
*
|
*
|
||||||
* @return false |null
|
* @return false | null
|
||||||
*/
|
*/
|
||||||
private function check_setup_status()
|
private function check_setup_status()
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-7
@@ -9,34 +9,35 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.3",
|
"php": "^7.3",
|
||||||
"guzzlehttp/guzzle": "^7.2.0",
|
"brianium/paratest": "^6.2",
|
||||||
"cartalyst/stripe-laravel": "^13.1",
|
"cartalyst/stripe-laravel": "^13.1",
|
||||||
"doctrine/dbal": "^2.12.1",
|
"doctrine/dbal": "^2.12.1",
|
||||||
"fideloper/proxy": "^4.0",
|
"fideloper/proxy": "^4.0",
|
||||||
"fruitcake/laravel-cors": "^2.0",
|
"fruitcake/laravel-cors": "^2.0",
|
||||||
"gabrielelana/byte-units": "^0.5.0",
|
"gabrielelana/byte-units": "^0.5.0",
|
||||||
|
"guzzlehttp/guzzle": "^7.2.0",
|
||||||
"intervention/image": "^2.5.1",
|
"intervention/image": "^2.5.1",
|
||||||
"jaybizzle/laravel-crawler-detect": "^1.2",
|
"jaybizzle/laravel-crawler-detect": "^1.2",
|
||||||
"kyslik/column-sortable": "^6.4",
|
"kyslik/column-sortable": "^6.4",
|
||||||
"laravel/fortify": "^1.7.7",
|
|
||||||
"laravel/sanctum": "^2.9",
|
|
||||||
"laravel/cashier": "^12.9.1",
|
"laravel/cashier": "^12.9.1",
|
||||||
|
"laravel/fortify": "^1.7.7",
|
||||||
"laravel/framework": "^8.26.1",
|
"laravel/framework": "^8.26.1",
|
||||||
"teamtnt/laravel-scout-tntsearch-driver": "^11.1",
|
"laravel/sanctum": "^2.9",
|
||||||
"laravel/tinker": "^2.0",
|
"laravel/tinker": "^2.0",
|
||||||
"laravel/ui": "^3.0",
|
"laravel/ui": "^3.0",
|
||||||
"league/flysystem-aws-s3-v3": "^1.0",
|
"league/flysystem-aws-s3-v3": "^1.0",
|
||||||
"league/flysystem-cached-adapter": "^1.0",
|
"league/flysystem-cached-adapter": "^1.0",
|
||||||
"madnest/madzipper": "^1.1"
|
"madnest/madzipper": "^1.1",
|
||||||
|
"teamtnt/laravel-scout-tntsearch-driver": "^11.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"ext-json": "*",
|
||||||
"barryvdh/laravel-ide-helper": "^2.7",
|
"barryvdh/laravel-ide-helper": "^2.7",
|
||||||
"facade/ignition": "^2.3.6",
|
"facade/ignition": "^2.3.6",
|
||||||
"fzaninotto/faker": "^1.9.1",
|
"fzaninotto/faker": "^1.9.1",
|
||||||
"mockery/mockery": "^1.3.1",
|
"mockery/mockery": "^1.3.1",
|
||||||
"nunomaduro/collision": "^5.0",
|
"nunomaduro/collision": "^5.0",
|
||||||
"phpunit/phpunit": "^9.5.2",
|
"phpunit/phpunit": "^9.5.2"
|
||||||
"ext-json": "*"
|
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
|
|||||||
Generated
+1851
-1775
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,14 @@ class SetupWizardTest extends TestCase
|
|||||||
{
|
{
|
||||||
use DatabaseMigrations;
|
use DatabaseMigrations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CAVEAT:
|
||||||
|
*
|
||||||
|
* The route '/api/setup/stripe-plans' which is part of setup wizard is moved to
|
||||||
|
* SubscriptionTest.php to group all live API test. For more info how to test
|
||||||
|
* subscription integration in VueFileManager platform visit https://laravel.com/docs/8.x/billing#testing
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace Tests\Feature;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Laravel\Sanctum\Sanctum;
|
use Laravel\Sanctum\Sanctum;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
@@ -293,4 +294,33 @@ class SubscriptionTest extends TestCase
|
|||||||
'customer' => $this->user['stripe_id']
|
'customer' => $this->user['stripe_id']
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function it_store_stripe_plans_via_setup_wizard()
|
||||||
|
{
|
||||||
|
$this->postJson('/api/setup/stripe-plans', [
|
||||||
|
'plans' => [
|
||||||
|
[
|
||||||
|
'type' => 'plan',
|
||||||
|
'attributes' => [
|
||||||
|
'name' => 'test-plan-' . Str::random(16),
|
||||||
|
'price' => (string) rand(1, 99),
|
||||||
|
'description' => 'Some random description',
|
||||||
|
'capacity' => rand(1, 999),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => 'plan',
|
||||||
|
'attributes' => [
|
||||||
|
'name' => 'test-plan-' . Str::random(16),
|
||||||
|
'price' => (string) rand(1, 99),
|
||||||
|
'description' => 'Some random description',
|
||||||
|
'capacity' => rand(1, 999),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
])->assertStatus(204);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user