ANG YU 5 роки тому
батько
коміт
dc0b5a01bf

+ 2 - 2
resources/views/package/logistic/index.blade.php

@@ -32,7 +32,7 @@
                     <td>@{{ package.exception }}</td>
                     <td>
 {{--                        <p v-for="log in getLogs(package.transfer_status)">@{{ log }}</p>--}}
-                        @{{ package.transfer_status | toObjeted }}
+                        @{{ package.transfer_status | toObjected }}
                     </td>
                     <td>@{{ package.remark }}</td>
                 </tr>
@@ -141,7 +141,7 @@
                 }
             },
             filters:{
-                toObjeted:function(value){
+                toObjected:function(value){
                     return JSON.parse(value);
                 }
             },

+ 20 - 9
tests/Services/NewOrderCountingRecordService/NewOrderCountingRecordServiceTest.php

@@ -14,10 +14,13 @@ use Tests\TestCase;
 
 class NewOrderCountingRecordServiceTest extends TestCase
 {
-    use RefreshDatabase;
-
     protected $newOrderCountingRecordService;
 
+    protected $orders;
+    protected $orderCountingRecords;
+    protected $owners;
+
+
     protected function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
@@ -30,9 +33,17 @@ class NewOrderCountingRecordServiceTest extends TestCase
     protected function tearDown(): void
     {
         cache()->flush();
-        OrderCountingRecord::truncate();
-        Order::truncate();
-        Owner::truncate();
+        foreach ($this->orders as $order) {
+            $order->delete();
+        }
+        foreach ($this->orderCountingRecords as $orderCountingRecord) {
+            $orderCountingRecord->delete();
+        }
+
+        foreach ($this->owners as $owner) {
+            $owner->delete();
+        }
+
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 
@@ -41,7 +52,7 @@ class NewOrderCountingRecordServiceTest extends TestCase
      */
     public function transfersToConditions()
     {
-        factory(Owner::class)->times(2)->create();
+        $this->owners = factory(Owner::class)->times(2)->create();
         $start = Carbon::now()->subDays(2)->toDateString();
         $end = Carbon::now()->toDateString();
         $unit = '日';
@@ -59,7 +70,7 @@ class NewOrderCountingRecordServiceTest extends TestCase
      */
     public function dateUtils_week()
     {
-        factory(Owner::class)->times(2)->create();
+        $this->owners = factory(Owner::class)->times(2)->create();
         $start = Carbon::now()->subWeeks(2)->toDateString();
         $end = Carbon::now()->toDateString();
         $unit = '周';
@@ -288,7 +299,7 @@ class NewOrderCountingRecordServiceTest extends TestCase
         $owner1 = factory(Owner::class)->create();
         $owner2 = factory(Owner::class)->create();
 
-        $unQueryCondition = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit,$this->newOrderCountingRecordService->getCountingOwnerIds());
+        $unQueryCondition = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $this->newOrderCountingRecordService->getCountingOwnerIds());
 
         factory(Order::class)->times(1)->create(['wms_status' => '订单完成', 'created_at' => Carbon::now(), 'owner_id' => $owner1->id]);
         factory(Order::class)->times(2)->create(['wms_status' => '订单完成', 'created_at' => Carbon::now(), 'owner_id' => $owner2->id]);
@@ -324,7 +335,7 @@ class NewOrderCountingRecordServiceTest extends TestCase
 
         factory(Order::class)->times(3)->create(['wms_status' => '订单完成', 'created_at' => Carbon::now()->subDays(1), 'owner_id' => $owner1->id]);
         factory(Order::class)->times(4)->create(['wms_status' => '订单完成', 'created_at' => Carbon::now()->subDays(1), 'owner_id' => $owner2->id]);
-        $unQueryCondition = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit,$this->newOrderCountingRecordService->getCountingOwnerIds());
+        $unQueryCondition = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $this->newOrderCountingRecordService->getCountingOwnerIds());
 
         $result = $this->newOrderCountingRecordService->getOrderCountingRecords($unQueryCondition, $unit);
         $this->assertEquals(3, $result->where('date_target', Carbon::now()->toDateString())->reduce(function ($carry, $item) {