CaiWuXiTong/tests/Feature/Business/SupplierFreeShippingStoreTest.php
renshen 176357871b feat: 供应商管理新增是否包邮厂家
在供应商名称后新增「是否包邮厂家」,支持行内编辑、模板导入和导出;空白按不是包邮厂家处理。
2026-10-21 11:20:58 +08:00

31 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature\Business;
use Modules\EcommerceFinance\Services\SupplierFreeShippingStore;
use Tests\Feature\FeatureTestCase;
class SupplierFreeShippingStoreTest extends FeatureTestCase
{
public function test_marks_are_scoped_by_company_and_default_to_false(): void
{
$store = app(SupplierFreeShippingStore::class);
$companyId = (int) $this->company->id;
$store->save(9, true, $companyId, (int) $this->user->id, 'manual');
$store->save(11, false, $companyId, (int) $this->user->id, 'manual');
$rows = $store->decorateRows([
(object) ['Id' => 9],
(object) ['Id' => 11],
(object) ['Id' => 12],
], $companyId);
$this->assertTrue($rows[0]->free_shipping_manufacturer);
$this->assertFalse($rows[1]->free_shipping_manufacturer);
$this->assertFalse($rows[2]->free_shipping_manufacturer);
$otherCompanyRows = $store->decorateRows([(object) ['Id' => 9]], $companyId + 1);
$this->assertFalse($otherCompanyRows[0]->free_shipping_manufacturer);
}
}