107 lines
3.6 KiB
PHP
107 lines
3.6 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Business;
|
|
|
|
use App\Models\Auth\Permission;
|
|
use Tests\Feature\FeatureTestCase;
|
|
|
|
class SupplierPayablePagesTest extends FeatureTestCase
|
|
{
|
|
protected function grantAdminPermission(): void
|
|
{
|
|
$this->user->attachPermission(
|
|
Permission::where('name', 'read-admin-panel')->firstOrFail()
|
|
);
|
|
}
|
|
|
|
public function testDeliveryUnpricedPageUsesItsOwnTwentyColumnTable()
|
|
{
|
|
$this->grantAdminPermission();
|
|
|
|
$response = $this->loginAs()->get(route('business.pages.show', [
|
|
'section' => 'supplier-payables',
|
|
'page' => 'delivery-unpriced',
|
|
]));
|
|
|
|
$response
|
|
->assertOk()
|
|
->assertSee('id="delivery-unpriced-app"', false)
|
|
->assertSee('来源单号')
|
|
->assertSee('单据编号(采购单号)')
|
|
->assertSee('负责人')
|
|
->assertSee('public/js/ecommerce-finance/delivery-unpriced.min.js', false)
|
|
->assertDontSee('class="business-blank-page"', false);
|
|
|
|
$this->assertSame(20, substr_count($response->getContent(), '<el-table-column'));
|
|
}
|
|
|
|
public function testReturnUnpricedPageUsesItsOwnTwentyColumnTable()
|
|
{
|
|
$this->grantAdminPermission();
|
|
|
|
$response = $this->loginAs()->get(route('business.pages.show', [
|
|
'section' => 'supplier-payables',
|
|
'page' => 'return-unpriced',
|
|
]));
|
|
|
|
$response
|
|
->assertOk()
|
|
->assertSee('id="return-unpriced-app"', false)
|
|
->assertSee('明细供应商')
|
|
->assertSee('供应商条码')
|
|
->assertSee('对账人')
|
|
->assertSee('public/js/ecommerce-finance/return-unpriced.min.js', false)
|
|
->assertDontSee('class="business-blank-page"', false);
|
|
|
|
$this->assertSame(20, substr_count($response->getContent(), '<el-table-column'));
|
|
}
|
|
|
|
public function testBoardDeductionsPageUsesItsOwnSeventeenColumnTable()
|
|
{
|
|
$this->grantAdminPermission();
|
|
|
|
$response = $this->loginAs()->get(route('business.pages.show', [
|
|
'section' => 'supplier-payables',
|
|
'page' => 'board-deductions',
|
|
]));
|
|
|
|
$response
|
|
->assertOk()
|
|
->assertSee('class="supplier-board-table"', false)
|
|
->assertSee('入库日期')
|
|
->assertSee('出库备注')
|
|
->assertSee('送货单号')
|
|
->assertDontSee('class="business-blank-page"', false);
|
|
|
|
preg_match_all('/<th(?:\s|>)/', $response->getContent(), $headers);
|
|
|
|
$this->assertCount(17, $headers[0]);
|
|
}
|
|
|
|
public function testSupplierPayablesReportPageUsesItsOwnThirtyFourColumnGroupedTable()
|
|
{
|
|
$this->grantAdminPermission();
|
|
|
|
$response = $this->loginAs()->get(route('business.pages.show', [
|
|
'section' => 'supplier-payables',
|
|
'page' => 'supplier-payables-report',
|
|
]));
|
|
|
|
$response
|
|
->assertOk()
|
|
->assertSee('class="supplier-payables-report-table"', false)
|
|
->assertSee('已销账供应商')
|
|
->assertSee('本月采购金额')
|
|
->assertSee('<th class="group-addition">加</th>', false)
|
|
->assertSee('<th colspan="6" class="group-payment">单位:元</th>', false)
|
|
->assertSee('<th class="group-payment">供应商余额</th>', false)
|
|
->assertSee('最晚出账单时间(新执行标准)')
|
|
->assertDontSee('class="business-blank-page"', false);
|
|
|
|
preg_match_all('/<col(?:\s|>)/', $response->getContent(), $columns);
|
|
|
|
$this->assertCount(34, $columns[0]);
|
|
}
|
|
|
|
}
|