diff --git a/phpunit.xml b/phpunit.xml index 1bf28697..d1ff7a1f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -20,10 +20,12 @@ + + diff --git a/tests/Feature/Business/PagesTest.php b/tests/Feature/Business/PagesTest.php index 8cb79566..1d369379 100644 --- a/tests/Feature/Business/PagesTest.php +++ b/tests/Feature/Business/PagesTest.php @@ -109,4 +109,33 @@ class PagesTest extends FeatureTestCase ->assertDontSee('class="business-blank-page"', false); } } + + public function testMergedFeaturePagesRenderTheirDedicatedContent() + { + $this->user->attachPermission( + Permission::where('name', 'read-admin-panel')->firstOrFail() + ); + + $pages = [ + ['supplier-payables', 'product-prices', '暂无商品价格数据'], + ['courier-payables', 'freight-reconciliation', '快递单号'], + ['courier-payables', 'bookkeeping-details', '暂无记账明细'], + ['courier-payables', 'compensation-details', '暂无赔偿明细'], + ['courier-payables', 'advance-details', '暂无借支明细'], + ['courier-payables', 'other-adjustments', '暂无其他扣款补款明细'], + ['raw-board-payables', 'board-prices', '暂无素板价格数据'], + ['raw-board-payables', 'board-reconciliation', '暂无素板对账数据'], + ['raw-board-payables', 'compensation-details', '暂无素板赔付明细'], + ['raw-board-payables', 'board-payables-report', '暂无素板应付汇总数据'], + ['inventory-management', 'board-inventory-details', '暂无板材库存明细数据'], + ]; + + foreach ($pages as [$section, $page, $expectedText]) { + $this->loginAs() + ->get(route('business.pages.show', compact('section', 'page'))) + ->assertOk() + ->assertSeeText($expectedText) + ->assertDontSee('class="business-blank-page"', false); + } + } } diff --git a/tests/Feature/Settings/NavigationTest.php b/tests/Feature/Settings/NavigationTest.php index 9c87f8d9..d06d2c32 100644 --- a/tests/Feature/Settings/NavigationTest.php +++ b/tests/Feature/Settings/NavigationTest.php @@ -2,6 +2,8 @@ namespace Tests\Feature\Settings; +use App\Models\Auth\Permission; +use App\Models\Auth\Role; use App\Utilities\BusinessNavigation; use Tests\Feature\FeatureTestCase; @@ -9,6 +11,14 @@ class NavigationTest extends FeatureTestCase { public function testAdminCanUpdateSidebarLabels() { + $this->user->roles()->sync([ + Role::where('name', 'admin')->firstOrFail()->id, + ]); + + $this->user->attachPermission( + Permission::where('name', 'read-admin-panel')->firstOrFail() + ); + $this->loginAs() ->get(route('settings.navigation.manage')) ->assertOk()