83 lines
2.9 KiB
PHP
83 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Business;
|
|
|
|
use App\Models\Auth\Permission;
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
use Tests\Feature\FeatureTestCase;
|
|
|
|
class AgreementSigningPageTest extends FeatureTestCase
|
|
{
|
|
protected function grantWorkspaceAccess(): void
|
|
{
|
|
$this->user->attachPermission(
|
|
Permission::where('name', 'read-admin-panel')->firstOrFail()
|
|
);
|
|
}
|
|
|
|
public function testAgreementSigningPageRendersTheSigningWorkspace(): void
|
|
{
|
|
$this->grantWorkspaceAccess();
|
|
|
|
$this->loginAs()
|
|
->get(route('business.pages.show', [
|
|
'section' => 'courier-payables',
|
|
'page' => 'agreement-signing',
|
|
]))
|
|
->assertOk()
|
|
->assertSeeText('协议签署')
|
|
->assertSeeText('签署任务')
|
|
->assertSeeText('新建发起')
|
|
->assertSeeText('模板管理')
|
|
->assertSeeText('E签宝未连接')
|
|
->assertSeeText('还没有协议签署任务')
|
|
->assertSeeText('收款账户变更证明.doc')
|
|
->assertSeeText('收款账户证明文件.doc')
|
|
->assertSeeText('公司主体变更证明.docx')
|
|
->assertSeeText('共用合同证明.docx')
|
|
->assertSeeText('授权委托书(快递).docx');
|
|
}
|
|
|
|
public function testAgreementSigningPageIncludesTheFourStepLocalFlow(): void
|
|
{
|
|
$this->grantWorkspaceAccess();
|
|
|
|
$this->loginAs()
|
|
->get(route('business.pages.show', [
|
|
'section' => 'courier-payables',
|
|
'page' => 'agreement-signing',
|
|
]))
|
|
->assertOk()
|
|
->assertSee('data-agreement-step-panel="1"', false)
|
|
->assertSee('data-agreement-step-panel="2"', false)
|
|
->assertSee('data-agreement-step-panel="3"', false)
|
|
->assertSee('data-agreement-step-panel="4"', false)
|
|
->assertSee('data-step-send', false)
|
|
->assertSeeText('E签宝尚未配置')
|
|
->assertSeeText('账户变更必须执行双人复核')
|
|
->assertSeeText('签署完成只生成可核验的电子协议');
|
|
}
|
|
|
|
public function testAgreementSigningPageRejectsUsersWithoutItsSidebarPermission(): void
|
|
{
|
|
$subject = 'user_' . $this->user->id;
|
|
|
|
setting()->set('system.sidebar_permissions', json_encode([
|
|
'configured' => [$subject],
|
|
'subjects' => [
|
|
$subject => ['courier-payables/freight-reconciliation'],
|
|
],
|
|
], JSON_UNESCAPED_UNICODE));
|
|
|
|
try {
|
|
$this->loginAs()->get(route('business.pages.show', [
|
|
'section' => 'courier-payables',
|
|
'page' => 'agreement-signing',
|
|
]));
|
|
$this->fail('没有协议签署页面权限的用户不应访问该页面。');
|
|
} catch (HttpException $exception) {
|
|
$this->assertSame(404, $exception->getStatusCode());
|
|
}
|
|
}
|
|
}
|