45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Settings;
|
|
|
|
use App\Models\Auth\Permission;
|
|
use App\Models\Auth\Role;
|
|
use App\Utilities\BusinessNavigation;
|
|
use Tests\Feature\FeatureTestCase;
|
|
|
|
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()
|
|
->assertSeeText('侧边栏功能名称');
|
|
|
|
$this->patch(route('settings.navigation.save'), [
|
|
'section_titles' => [
|
|
'company-management' => '企业档案',
|
|
],
|
|
'page_titles' => [
|
|
'company-management' => [
|
|
'registration' => '企业设立',
|
|
],
|
|
],
|
|
])->assertOk();
|
|
|
|
$navigation = BusinessNavigation::all();
|
|
|
|
$this->assertSame('企业档案', $navigation[0]['title']);
|
|
$this->assertSame('企业设立', $navigation[0]['pages'][0]['title']);
|
|
}
|
|
|
|
}
|