修复一些错误
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Models\StoreModel;
|
||||
use App\Models\StoreOrderItemModel;
|
||||
use App\Models\StoreOrderModel;
|
||||
use App\Models\UserModel;
|
||||
use Modules\SystemTool\Models\SysFileModel;
|
||||
|
||||
/**
|
||||
* 小程序账单:支付进度推导(待支付/审核中/已支付)、应结算日期(回款周期)、
|
||||
@@ -149,6 +150,18 @@ class MiniBillTest extends ProcurementTestCase
|
||||
[$store, $user] = $this->makeStoreWithUser(0);
|
||||
$this->actingAsMiniUser($user);
|
||||
|
||||
$file = SysFileModel::create([
|
||||
'group_id' => 1,
|
||||
'disk' => 'local',
|
||||
'channel' => 10,
|
||||
'file_type' => 10,
|
||||
'file_name' => '白菜.jpg',
|
||||
'file_path' => 'product/baicai.jpg',
|
||||
'file_size' => 1024,
|
||||
'file_ext' => 'jpg',
|
||||
'uploader_id' => 1,
|
||||
]);
|
||||
|
||||
$bill = $this->makeBill($store);
|
||||
$product = ProductModel::factory()->create(['status' => ProductModel::STATUS_ON]);
|
||||
$order = StoreOrderModel::factory()->create([
|
||||
@@ -164,9 +177,12 @@ class MiniBillTest extends ProcurementTestCase
|
||||
'store_id' => $store->id,
|
||||
'product_id' => $product->id,
|
||||
'product_name' => '白菜',
|
||||
'product_spec' => '30斤/筐',
|
||||
'unit' => '筐',
|
||||
'price' => '5.00',
|
||||
'quantity' => 20,
|
||||
'amount' => '100.00',
|
||||
'image_ids' => (string) $file->id,
|
||||
]);
|
||||
|
||||
$data = $this->getJson("/mini/bill/{$bill->id}")->assertOk()->json('data');
|
||||
@@ -178,9 +194,13 @@ class MiniBillTest extends ProcurementTestCase
|
||||
|
||||
$this->assertCount(1, $data['items']);
|
||||
$this->assertSame('白菜', $data['items'][0]['product_name']);
|
||||
$this->assertSame('30斤/筐', $data['items'][0]['product_spec'], '明细附规格');
|
||||
$this->assertSame('筐', $data['items'][0]['unit'], '明细附单位');
|
||||
$this->assertSame('5.00', $data['items'][0]['price'], '合并明细单价 = Σ金额 ÷ Σ数量');
|
||||
$this->assertSame(20, $data['items'][0]['quantity']);
|
||||
$this->assertSame('100.00', $data['items'][0]['amount']);
|
||||
$this->assertStringContainsString('baicai.jpg', (string) $data['items'][0]['image'], '明细附首图URL');
|
||||
$this->assertArrayNotHasKey('image_ids', $data['items'][0], 'image_ids 解析后不输出');
|
||||
|
||||
$this->assertCount(1, $data['orders']);
|
||||
$this->assertSame($order->order_no, $data['orders'][0]['order_no']);
|
||||
|
||||
Reference in New Issue
Block a user