Browse Source

控制台测试

ANG YU 5 years ago
parent
commit
06b8e4a7f7

+ 3 - 3
app/Services/NewOrderCountingRecordService.php

@@ -151,7 +151,6 @@ class NewOrderCountingRecordService
 
     public function getOrderCountingRecords($queryCondition)
     {
-
         list($orderCountingRecords_fromCache, $lackingCondition)
             = $this->getFromCache($queryCondition);
         if (empty($lackingCondition['data'])) {
@@ -165,7 +164,6 @@ class NewOrderCountingRecordService
         }
         list($orderCountingRecords_combinedByLower, $lackingCondition)
             = $this->getByLowerUnit($lackingCondition);
-
         if (!empty($lackingCondition)) {
             $orderCountingRecords_FromOrder = $this->dataFromOrder($lackingCondition);
         }
@@ -388,13 +386,15 @@ class NewOrderCountingRecordService
             switch ($unit) {
                 case "日":
                     $item['date_target'] = Carbon::parse($item['date_target'])->firstOfMonth()->toDateString();
+                    $item['counting_unit'] = '月';
                     break;
                 case "月":
                     $item['date_target'] = Carbon::parse($item['date_target'])->firstOfYear()->toDateString();
+                    $item['counting_unit'] = '年';
                     break;
             }
             $item['amount'] = $amount;
-            $item['counting_unit'] = $unit;
+
             return $result->push($item);
         }
         return $result;

+ 35 - 56
tests/Services/NewOrderCountingRecordService/GetOrderCountingRecordsTest.php

@@ -16,8 +16,6 @@ use Tightenco\Collect\Support\Arr;
 
 class GetOrderCountingRecordsTest extends TestCase
 {
-    use RefreshDatabase;
-
     protected $newOrderCountingRecordService;
     protected $queryConditionDay;
     protected $queryConditionWeek;
@@ -40,7 +38,6 @@ class GetOrderCountingRecordsTest extends TestCase
         $owners = factory(Owner::class)->times(2)->create();
         $this->ownerIds = array_column($owners->toArray(), 'id');
         $this->queryConditionDay = $this->newOrderCountingRecordService->transfersToCondition(Carbon::now()->subDays($this->step_length)->toDateString(), Carbon::now()->toDateString(), '日', $this->ownerIds);
-        $this->queryConditionWeek = $this->newOrderCountingRecordService->transfersToCondition(Carbon::now()->subWeeks($this->step_length)->toDateString(), Carbon::now()->toDateString(), '周', $this->ownerIds);
         $this->queryConditionMonth = $this->newOrderCountingRecordService->transfersToCondition(Carbon::now()->subMonths($this->step_length)->toDateString(), Carbon::now()->toDateString(), '月', $this->ownerIds);
         $this->queryConditionYear = $this->newOrderCountingRecordService->transfersToCondition(Carbon::now()->subYears($this->step_length)->toDateString(), Carbon::now()->toDateString(), '年', $this->ownerIds);
     }
@@ -49,62 +46,12 @@ class GetOrderCountingRecordsTest extends TestCase
     {
         cache()->flush();
         Owner::destroy($this->ownerIds);
-        orderCountingRecord::destroy($this->orderCountingRecordIds);
+        OrderCountingRecord::destroy($this->orderCountingRecordIds);
+        Order::destroy($this->orderIds);
+        OrderCountingRecord::query()->whereIn('owner_id', $this->ownerIds)->delete();
         parent::tearDown();
     }
 
-
-//    /**
-//     * @test
-//     */
-//    public function get_all_from_cache()
-//    {
-//        for ($i = 0; $i <= $this->step_length; $i++) {
-//            foreach ($this->ownerIds as $ownerId) {
-//                foreach ($this->units as $unit) {
-//                    switch ($unit) {
-//                        case "日":
-//                            $dateStr = Carbon::now()->subDays($i)->toDateString();
-//                            break;
-//                        case "月":
-//                            $dateStr = Carbon::now()->subMonths($i)->toDateString();
-//                            break;
-//                        default:
-//                            break;
-//                    }
-//                    if ($dateStr) {
-//                        $orderCountingRecord = factory(OrderCountingRecord::class)->create([
-//                            'date_target' => $dateStr,
-//                            'owner_id' => $ownerId,
-//                            'counting_unit' => $unit,
-//                        ]);
-//                        $key = 'order_counting_records_' . $dateStr . '_' . $ownerId . '_' . $unit;
-//                        cache()->put($key, collect()->push($orderCountingRecord));
-//                        if (empty($this->orderCountingRecordIds[$unit])) $this->orderCountingRecordIds[$unit] = [];
-//                        $this->orderCountingRecordIds[$unit][] = $orderCountingRecord->id;
-//                        $dateStr = null;
-//                    }
-//                }
-//            }
-//        }
-//        $resultDay = $this->newOrderCountingRecordService->getOrderCountingRecords($this->queryConditionDay);
-//        $resultWeek = $this->newOrderCountingRecordService->getOrderCountingRecords($this->queryConditionWeek);
-////        $resultMonth = $this->newOrderCountingRecordService->getOrderCountingRecords($this->queryConditionMonth);
-//        foreach ($this->units as $unit) {
-//            if (!empty($this->orderCountingRecordIds[$unit])) {
-//                switch ($unit) {
-//                    case "日":
-//                        $this->assertEquals($this->orderCountingRecordIds[$unit], array_column($resultDay->sortBy('id')->toArray(), 'id'));
-//                        break;
-//                    case "月":
-////                        $this->assertEquals($this->orderCountingRecordIds[$unit], array_column($resultMonth->sortBy('id')->toArray(), 'id'));
-//                        break;
-//                }
-//            }
-//        }
-//
-//    }
-
     /**
      * @test
      */
@@ -186,4 +133,36 @@ class GetOrderCountingRecordsTest extends TestCase
         $result = $this->newOrderCountingRecordService->getOrderCountingRecords($this->queryConditionYear);
         $this->assertEquals([1, 1, 1, 1], array_column($result->toArray(), 'amount'));
     }
+
+    /**
+     * 按照月份查询插入中间表的测试
+     * @test
+     */
+    public function insert_monthly_order_counting_records()
+    {
+        //前一个月的订单2个
+        $carbon = Carbon::now()->subMonths(1);
+        $orders1 = factory(Order::class)->times(2)->create(['created_at' => $carbon, 'owner_id' => $this->ownerIds[0], 'wms_status' => '订单完成']);
+        //本月本日的订单2个
+        $orders2 = factory(Order::class)->times(2)->create(['created_at' => Carbon::now(), 'owner_id' => $this->ownerIds[0], 'wms_status' => '订单完成']);
+        $orders = $orders1->merge($orders2);
+
+        $this->orderIds = array_column($orders->toArray(), 'id');
+        //判断中间表中没有上一个月,'counting_unit' => '月'   'owner_id' => $this->ownerIds[0], 的数据
+        $this->assertDatabaseMissing('order_counting_records', [
+            'date_target' => $carbon->startOfMonth()->toDateString(),
+            'owner_id' => $this->ownerIds[0],
+            'counting_unit' => '月',
+            'amount' => '2',
+        ]);
+        $result = $this->newOrderCountingRecordService->getOrderCountingRecords($this->queryConditionMonth);
+
+        $this->assertDatabaseHas('order_counting_records', [
+            'date_target' => $carbon->startOfMonth()->toDateString(),
+            'owner_id' => $this->ownerIds[0],
+            'counting_unit' => '月',
+            'amount' => '2',
+        ]);
+        dump($result->toArray());
+    }
 }

+ 0 - 348
tests/Services/NewOrderCountingRecordService/NewOrderCountingRecordServiceTest.php

@@ -1,348 +0,0 @@
-<?php
-
-namespace NewOrderCountingRecordService;
-
-use App\Order;
-use App\OrderCountingRecord;
-use App\Owner;
-use App\Services\NewOrderCountingRecordService;
-use App\User;
-use Carbon\Carbon;
-use Illuminate\Foundation\Testing\RefreshDatabase;
-use Illuminate\Support\Arr;
-use Tests\TestCase;
-
-class NewOrderCountingRecordServiceTest extends TestCase
-{
-    protected $newOrderCountingRecordService;
-
-    protected $orders;
-    protected $orderCountingRecords;
-    protected $owners;
-
-
-    protected function setUp(): void
-    {
-        parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
-        $this->newOrderCountingRecordService = new NewOrderCountingRecordService();
-        $this->actingAs(factory(User::class)->create(['name' => 'yang']));
-
-    }
-
-    protected function tearDown(): void
-    {
-        cache()->flush();
-        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
-    }
-
-    /**
-     * @test
-     */
-    public function transfersToConditions()
-    {
-        $this->owners = factory(Owner::class)->times(2)->create();
-        $start = Carbon::now()->subDays(2)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-        $dateArray = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-        $this->assertEquals([
-            Carbon::now()->subDays(2)->toDateString() => [0 => 1, 1 => 2],
-            Carbon::now()->subDays(1)->toDateString() => [0 => 1, 1 => 2],
-            Carbon::now()->toDateString() => [0 => 1, 1 => 2],
-        ], $dateArray);
-    }
-
-    /**
-     * @test
-     */
-    public function dateUtils_week()
-    {
-        $this->owners = factory(Owner::class)->times(2)->create();
-        $start = Carbon::now()->subWeeks(2)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '周';
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-        $dateArray = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-        dd($dateArray);
-//        $this->assertEquals([
-//            Carbon::now()->subWeeks(2)->toDateString() => [0 => 1, 1 => 2],
-//            Carbon::now()->subWeeks(1)->toDateString() => [0 => 1, 1 => 2],
-//            Carbon::now()->toDateString() => [0 => 1, 1 => 2],
-//        ], $dateArray);
-    }
-
-
-    /**
-     * @test
-     */
-    public function orderCountingRecords_remember_day()
-    {
-        $start = Carbon::now()->subDays(2)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        $key = 'orderCountingRecords_' . $start . '_' . $end . '_' . $unit . '_' . auth()->id();
-
-        cache()->put($key, 'This is a test value');
-
-        $result = $this->newOrderCountingRecordService->get($start, $end, $unit);
-        $this->assertEquals('This is a test value', $result);
-    }
-
-
-    /**
-     * @test
-     */
-    public function dataFromCache_all_day()
-    {
-        $start = Carbon::now()->subDays(2)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        factory(Owner::class)->times(2)->create();
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-        $queryCondition = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-
-        foreach ($queryCondition as $dateStr => $ownerIds) {
-            foreach ($ownerIds as $ownerId) {
-                $key = 'order_counting_records_' . $dateStr . '_' . $ownerId . '_' . $unit . '_' . auth()->id();
-                cache()->put($key, collect()->push(factory(Owner::class)->create()));
-            }
-        }
-        $result = $this->newOrderCountingRecordService->getFromCache($queryCondition, $unit);
-        $this->assertCount(6, $result['dataFromCache']);
-    }
-
-    /**
-     * @test
-     */
-    public function dataFromCache_empty_day()
-    {
-        $start = Carbon::now()->subDays(2)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        factory(Owner::class)->times(2)->create();
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-        $queryCondition = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-
-
-        $result = $this->newOrderCountingRecordService->getFromCache($queryCondition, $unit);
-        $this->assertEquals([
-            Carbon::now()->subDays(2)->toDateString() => [0 => 1, 1 => 2],
-            Carbon::now()->subDays(1)->toDateString() => [0 => 1, 1 => 2],
-            Carbon::now()->toDateString() => [0 => 1, 1 => 2],
-        ], $result['unQueryCondition']);
-    }
-
-    /**
-     * @test
-     */
-    public function dataFromMiddleTable_all_day()
-    {
-        $start = Carbon::now()->subDays(1)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        $owner1 = factory(Owner::class)->create();
-        $owner2 = factory(Owner::class)->create();
-        factory(OrderCountingRecord::class)->times(2)->create(['date_target' => Carbon::now()->toDateString(), 'owner_id' => $owner1->id]);
-        factory(OrderCountingRecord::class)->times(2)->create(['date_target' => Carbon::now()->toDateString(), 'owner_id' => $owner2->id]);
-        factory(OrderCountingRecord::class)->times(2)->create(['date_target' => Carbon::now()->subDays(1)->toDateString(), 'owner_id' => $owner1->id]);
-        factory(OrderCountingRecord::class)->times(2)->create(['date_target' => Carbon::now()->subDays(1)->toDateString(), 'owner_id' => $owner2->id]);
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-
-        $queryCondition = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-        $result = $this->newOrderCountingRecordService->dataFromMiddleTable($queryCondition, $unit);
-
-        $this->assertCount(8, $result['dataFromMiddleTable']);
-        $this->assertCount(0, $result['unQueryCondition'][Carbon::now()->toDateString()]);
-        $this->assertCount(0, $result['unQueryCondition'][Carbon::now()->subDays(1)->toDateString()]);
-    }
-
-    /**
-     * @test
-     */
-    public function dataFromMiddleTable_empty_day()
-    {
-        $start = Carbon::now()->subDays(1)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        factory(Owner::class)->create();
-        factory(Owner::class)->create();
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-
-        $dateArray = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-        $result = $this->newOrderCountingRecordService->dataFromMiddleTable($dateArray, $unit);
-
-        $this->assertCount(0, $result['dataFromMiddleTable']);
-        $this->assertCount(2, $result['unQueryCondition'][Carbon::now()->toDateString()]);
-        $this->assertCount(2, $result['unQueryCondition'][Carbon::now()->subDays(1)->toDateString()]);
-    }
-
-    /**
-     * @test
-     */
-    public function dataFromMiddleTable_common_day()
-    {
-        $start = Carbon::now()->subDays(1)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        $owner1 = factory(Owner::class)->create();
-        $owner2 = factory(Owner::class)->create();
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-
-        $dateArray = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-        factory(OrderCountingRecord::class)->times(2)->create(['date_target' => Carbon::now()->toDateString(), 'owner_id' => $owner1->id]);
-
-        $result = $this->newOrderCountingRecordService->dataFromMiddleTable($dateArray, $unit);
-
-        $this->assertCount(2, $result['dataFromMiddleTable']);
-        $this->assertCount(1, $result['unQueryCondition'][Carbon::now()->toDateString()]);
-        $this->assertCount(2, $result['unQueryCondition'][Carbon::now()->subDays(1)->toDateString()]);
-    }
-
-    /**
-     * @test
-     */
-    public function insertIntoCache_day()
-    {
-        $start = Carbon::now()->subDays(1)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        $owner1 = factory(Owner::class)->create();
-        $owner2 = factory(Owner::class)->create();
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-
-        $dateArray = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-        $orderCountingRecord = factory(OrderCountingRecord::class)->times(2)->create(['date_target' => Carbon::now()->toDateString(), 'owner_id' => $owner1->id]);
-
-        $result = $this->newOrderCountingRecordService->dataFromMiddleTable($dateArray, $unit);
-
-        $this->newOrderCountingRecordService->insertIntoCache($result['dataFromMiddleTable'], $unit);
-        $key = 'order_counting_records_' . Carbon::now()->toDateString() . '_' . $owner1->id . '_' . $unit;
-        $this->assertNotNull(cache()->get($key));
-        $this->assertNotNull($orderCountingRecord->toArray());
-        $this->assertEquals($orderCountingRecord->toArray(), cache()->get($key)->toArray());
-    }
-
-    /**
-     * @test
-     */
-    public function dataFromOrder_day()
-    {
-        $start = Carbon::now()->subDays(1)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        $owner1 = factory(Owner::class)->create();
-        $owner2 = factory(Owner::class)->create();
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-
-        $unQueryCondition = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-
-        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]);
-
-        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]);
-
-        $result = $this->newOrderCountingRecordService->dataFromOrder($unQueryCondition, $unit);
-        $this->assertEquals(1, $result->where('date_target', Carbon::now()->toDateString())->where('owner_id', $owner1->id)->first()->amount);
-        $this->assertEquals(2, $result->where('date_target', Carbon::now()->toDateString())->where('owner_id', $owner2->id)->first()->amount);
-        $this->assertEquals(3, $result->where('date_target', Carbon::now()->subDays(1)->toDateString())->where('owner_id', $owner1->id)->first()->amount);
-        $this->assertEquals(4, $result->where('date_target', Carbon::now()->subDays(1)->toDateString())->where('owner_id', $owner2->id)->first()->amount);
-    }
-
-    /**
-     * @test
-     */
-    public function dataFromOrder_insertMiddleTable_day()
-    {
-        $start = Carbon::now()->subDays(1)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        $owner1 = factory(Owner::class)->create();
-        $owner2 = factory(Owner::class)->create();
-        $ownerIds = $this->newOrderCountingRecordService->getCountingOwnerIds();
-        $unQueryCondition = $this->newOrderCountingRecordService->transfersToCondition($start, $end, $unit, $ownerIds);
-
-        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]);
-
-        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]);
-
-        $this->newOrderCountingRecordService->dataFromOrder($unQueryCondition, $unit);
-        //当天的数据不入中间表
-        $this->assertCount(0, OrderCountingRecord::query()->where('date_target', Carbon::now()->toDateString())->get());
-        $this->assertCount(2, OrderCountingRecord::query()->where('date_target', Carbon::now()->subDays(1)->toDateString())->get());
-
-    }
-
-    /**
-     * @test
-     */
-    public function dataFromOrder_insertCache_day()
-    {
-        $start = Carbon::now()->subDays(1)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        $owner1 = factory(Owner::class)->create();
-        $owner2 = factory(Owner::class)->create();
-
-        $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]);
-
-        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]);
-
-        $this->newOrderCountingRecordService->dataFromOrder($unQueryCondition, $unit);
-        $key1 = 'order_counting_records_' . Carbon::now()->toDateString() . '_' . $owner1->id . '_' . $unit;
-        $key2 = 'order_counting_records_' . Carbon::now()->toDateString() . '_' . $owner2->id . '_' . $unit;
-        $key3 = 'order_counting_records_' . Carbon::now()->subDays(1)->toDateString() . '_' . $owner1->id . '_' . $unit;
-        $key4 = 'order_counting_records_' . Carbon::now()->subDays(1)->toDateString() . '_' . $owner2->id . '_' . $unit;
-        $this->assertCount(1, cache()->get($key1));
-        $this->assertCount(1, cache()->get($key2));
-        $this->assertCount(1, cache()->get($key3));
-        $this->assertCount(1, cache()->get($key4));
-    }
-
-    /**
-     * @test
-     */
-    public function orderCountingRecordsDay_day()
-    {
-        $start = Carbon::now()->subDays(1)->toDateString();
-        $end = Carbon::now()->toDateString();
-        $unit = '日';
-        $owner1 = factory(Owner::class)->create();
-        $owner2 = factory(Owner::class)->create();
-
-
-        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]);
-
-        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());
-
-        $result = $this->newOrderCountingRecordService->getOrderCountingRecords($unQueryCondition, $unit);
-        $this->assertEquals(3, $result->where('date_target', Carbon::now()->toDateString())->reduce(function ($carry, $item) {
-            return $carry + $item->amount;
-        }));
-        $this->assertEquals(7, $result->where('date_target', Carbon::now()->subDays(1)->toDateString())->reduce(function ($carry, $item) {
-            return $carry + $item->amount;
-        }));
-    }
-}

+ 0 - 1
tests/Services/NewOrderCountingRecordService/OrderCountingRecordsTest.php

@@ -14,7 +14,6 @@ use Tests\TestCase;
 
 class OrderCountingRecordsTest extends TestCase
 {
-    use RefreshDatabase;
 
     protected $newOrderCountingRecordService;
     protected $queryConditionDay;

+ 0 - 4
tests/Services/NewOrderCountingRecordService/TransfersToConditionsTest.php

@@ -88,10 +88,6 @@ class TransfersToConditionsTest extends TestCase
                         ->map(function(Carbon $date){
                             return $date->firstOfMonth();
                         })->toArray();break;
-                    case '周': $datesExpected=collect($date['startAt']->weeksUntil($date['endAt'], 1)->toArray())
-                        ->map(function(Carbon $date){
-                            return $date->startOfWeek();
-                        })->toArray();break;
                     case '日': $datesExpected=collect($date['startAt']->daysUntil($date['endAt'], 1)->toArray())
                         ->map(function(Carbon $date){
                             return $date->startOfDay();