diff --git a/config/business_navigation.php b/config/business_navigation.php index 9a0bdba2..702d1808 100644 --- a/config/business_navigation.php +++ b/config/business_navigation.php @@ -142,7 +142,10 @@ return [ 'slug' => 'refunds', 'title' => '退款', 'icon' => 'assignment_return', - 'pages' => [], + 'pages' => [ + ['slug' => 'jingxi-refund-data', 'title' => '京喜退款数据'], + ['slug' => 'non-jingxi-refund-data', 'title' => '非京喜退款数据'], + ], ], [ 'slug' => 'store-receivables', diff --git a/tests/Feature/Business/PagesTest.php b/tests/Feature/Business/PagesTest.php index 3dea32f8..08a2101f 100644 --- a/tests/Feature/Business/PagesTest.php +++ b/tests/Feature/Business/PagesTest.php @@ -80,7 +80,7 @@ class PagesTest extends FeatureTestCase ->assertDontSee('class="business-blank-page"', false); } - public function testRefundSectionUsesTheGenericBusinessPageRoute() + public function testRefundPagesUseTheGenericBusinessPageRoute() { $this->user->attachPermission( Permission::where('name', 'read-admin-panel')->firstOrFail() @@ -90,10 +90,29 @@ class PagesTest extends FeatureTestCase ->get(route('business.pages.show', [ 'section' => 'refunds', ])) - ->assertOk() - ->assertSeeText('退款') - ->assertSeeText('该页面暂未配置数据表,敬请期待。') - ->assertSee('class="biz-empty"', false); + ->assertRedirect(route('business.pages.show', [ + 'section' => 'refunds', + 'page' => 'jingxi-refund-data', + ])); + + foreach ([ + 'jingxi-refund-data' => '京喜退款数据', + 'non-jingxi-refund-data' => '非京喜退款数据', + ] as $page => $title) { + $this->get(route('business.pages.show', [ + 'section' => 'refunds', + 'page' => $page, + ])) + ->assertOk() + ->assertSeeText($title) + ->assertSeeText('该页面暂未配置数据表,敬请期待。') + ->assertSee('class="biz-empty"', false); + } + + $this->withExceptionHandling()->get(route('business.pages.show', [ + 'section' => 'refunds', + 'page' => 'unknown-refund-page', + ]))->assertNotFound(); } public function testPaperMaterialPagesRenderAsSeparateTables() diff --git a/tests/Feature/Settings/NavigationTest.php b/tests/Feature/Settings/NavigationTest.php index 4aa89068..6039d0a5 100644 --- a/tests/Feature/Settings/NavigationTest.php +++ b/tests/Feature/Settings/NavigationTest.php @@ -72,7 +72,14 @@ class NavigationTest extends FeatureTestCase ); $this->assertSame('退款', $refund['title']); $this->assertSame('assignment_return', $refund['icon']); - $this->assertSame([], $refund['pages']); + $this->assertSame( + ['jingxi-refund-data', 'non-jingxi-refund-data'], + array_column($refund['pages'], 'slug') + ); + $this->assertSame( + ['京喜退款数据', '非京喜退款数据'], + array_column($refund['pages'], 'title') + ); } }