Include back param in subscription show 'open in platform orders' link
This commit is contained in:
@@ -305,7 +305,7 @@
|
|||||||
<span class="muted">|</span>
|
<span class="muted">|</span>
|
||||||
<a href="?order_sync_status=syncable" class="muted">可同步</a>
|
<a href="?order_sync_status=syncable" class="muted">可同步</a>
|
||||||
<span class="muted">|</span>
|
<span class="muted">|</span>
|
||||||
<a href="/admin/platform-orders?site_subscription_id={{ $subscription->id }}" class="muted">在平台订单页打开</a>
|
<a href="/admin/platform-orders?site_subscription_id={{ $subscription->id }}&back={{ urlencode(request()->getRequestUri()) }}" class="muted">在平台订单页打开</a>
|
||||||
@if($cur)
|
@if($cur)
|
||||||
<span class="muted">(当前:{{ $cur }})</span>
|
<span class="muted">(当前:{{ $cur }})</span>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Models\Merchant;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\SiteSubscription;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminSiteSubscriptionOrdersTableOpenInPlatformOrdersLinkContainsBackTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
protected function loginAsPlatformAdmin(): void
|
||||||
|
{
|
||||||
|
$this->seed();
|
||||||
|
|
||||||
|
$this->post('/admin/login', [
|
||||||
|
'email' => 'platform.admin@demo.local',
|
||||||
|
'password' => 'Platform@123456',
|
||||||
|
])->assertRedirect('/admin');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_orders_table_open_in_platform_orders_link_contains_back_param(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$merchant = Merchant::query()->firstOrFail();
|
||||||
|
$plan = Plan::query()->create([
|
||||||
|
'code' => 'sub_orders_open_po_back_plan',
|
||||||
|
'name' => '订阅详情在平台订单页打开 back 参数测试套餐',
|
||||||
|
'billing_cycle' => 'monthly',
|
||||||
|
'price' => 10,
|
||||||
|
'list_price' => 10,
|
||||||
|
'status' => 'active',
|
||||||
|
'sort' => 10,
|
||||||
|
'published_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$sub = SiteSubscription::query()->create([
|
||||||
|
'merchant_id' => $merchant->id,
|
||||||
|
'plan_id' => $plan->id,
|
||||||
|
'status' => 'activated',
|
||||||
|
'source' => 'manual',
|
||||||
|
'subscription_no' => 'SUB_OPEN_PO_BACK_0001',
|
||||||
|
'plan_name' => $plan->name,
|
||||||
|
'billing_cycle' => $plan->billing_cycle,
|
||||||
|
'period_months' => 1,
|
||||||
|
'amount' => 10,
|
||||||
|
'starts_at' => now()->subDay(),
|
||||||
|
'ends_at' => now()->addMonth(),
|
||||||
|
'activated_at' => now()->subDay(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$res = $this->get('/admin/site-subscriptions/' . $sub->id);
|
||||||
|
$res->assertOk();
|
||||||
|
|
||||||
|
$expectedBack = urlencode('/admin/site-subscriptions/' . $sub->id);
|
||||||
|
$res->assertSee('/admin/platform-orders?site_subscription_id=' . $sub->id . '&back=' . $expectedBack, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user