Files
ECShopX/tests/EmployeesUploadServiceRowLimitTest.php
wanghai e24f7d77b5 4.6.0
2026-05-15 16:44:39 +08:00

28 lines
1.0 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
use EmployeePurchaseBundle\Services\EmployeesUploadService;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
final class EmployeesUploadServiceRowLimitTest extends TestCase
{
public function testAssertImportDataRowsWithinLimitAllowsUpToMax(): void
{
$this->expectNotToPerformAssertions();
EmployeesUploadService::assertImportDataRowsWithinLimit(EmployeesUploadService::MAX_IMPORT_DATA_ROWS);
EmployeesUploadService::assertImportDataRowsWithinLimit(0);
}
public function testAssertImportDataRowsWithinLimitThrowsWhenOverLimit(): void
{
$expected = sprintf(
'每次最多上传%d条员工数据不含表头...请减少后再提交',
EmployeesUploadService::MAX_IMPORT_DATA_ROWS
);
$this->expectException(BadRequestHttpException::class);
$this->expectExceptionMessage($expected);
EmployeesUploadService::assertImportDataRowsWithinLimit(EmployeesUploadService::MAX_IMPORT_DATA_ROWS + 1);
}
}