LD 5 rokov pred
rodič
commit
e5fabbdce1

+ 0 - 3
app/Http/Controllers/TestController.php

@@ -255,9 +255,6 @@ class TestController extends Controller
 
     function t1(Request $request)
     {
-        $user=City::query()->first();
-        $user['created_at'] = '2020-12-23';
-        $user->save();
     }
 
     function packageT(Request $request)

+ 4 - 0
app/Services/BatchService.php

@@ -70,6 +70,10 @@ Class BatchService
         $this->stationTaskBatchService->runMany($stationTaskBatches);//执行波次任务
     }
 
+    public function x($codes){
+
+    }
+
     public function getBatchByCodes($codes)
     {
         if(empty($codes))return collect();

+ 3 - 2
app/Services/StationRuleBatchService.php

@@ -16,8 +16,9 @@ class StationRuleBatchService
     {
         $batchType = $batch['type'] ?? 'null';
         $ownerId = $batch['owner_id'] ?? 'null';
-        return Cache::remember('stationType_type_'.$batchType.'_ownerId_'.$ownerId, config('cache.expirations.rarelyChange'),function($batch){
-            return StationRuleBatch::query()->with('stationType')->where('batch_type',$batch['type'])
+        return Cache::remember('stationRuleBatch_batchType_'.$batchType.'_ownerId_'.$ownerId, config('cache.expirations.rarelyChange'),function($batch){
+            return StationRuleBatch::query()->with('stationType')
+                ->where('batch_type',$batch['type'])
                 ->where('owner_id',$batch['owner_id'])
                 ->first();
         });

+ 1 - 0
app/Services/StationTaskMaterialBoxService.php

@@ -138,6 +138,7 @@ class StationTaskMaterialBoxService
                 data_get($stationTaskMaterialBox, '*.station_id')
             );
     }
+
     function excepted($stationTaskMaterialBox_orBox){
         switch (get_class($stationTaskMaterialBox_orBox)){
 //            case MaterialBox::class:

+ 12 - 0
tests/Controller/api/thirdPart/haiq/StorageController/TestStorageController.php

@@ -0,0 +1,12 @@
+<?php
+
+
+namespace Tests\Controller\api\thirdPart\haiq;
+
+
+use Tests\TestCase;
+
+class TestStorageController extends TestCase
+{
+
+}

+ 40 - 0
tests/Services/BatchService/TestAssignTasks.php

@@ -0,0 +1,40 @@
+<?php
+
+namespace Tests\Services\BatchService;
+
+use App\Batch;
+use App\Services\BatchService;
+use Tests\TestCase;
+
+class TestAssignTasks extends TestCase
+{
+//    use RefreshDatabase;
+
+    /** @var BatchService $service */
+    private $service;
+    private $data = [];
+
+    public function setUp(): void
+    {
+        parent::setUp();
+        $this->service = app('BatchService');
+        $batches = factory(Batch::class,3)->create();
+        $this->data['batches'] = $batches;
+    }
+
+    /**
+     * @test
+     */
+    public function gotShouldProcessingBatches()
+    {
+        $this->assertTrue(true);
+    }
+
+    public function tearDown(): void
+    {
+        Batch::query()
+            ->whereIn('id',data_get($this->data['batches'],'*.id'))
+            ->delete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+}

+ 0 - 1
tests/Services/BatchService/TestGetBatchByCodes.php

@@ -4,7 +4,6 @@ namespace Tests\Services\BatchService;
 
 use App\Batch;
 use App\Services\BatchService;
-use Illuminate\Foundation\Testing\RefreshDatabase;
 use Tests\TestCase;
 
 class TestGetBatchByCodes extends TestCase

+ 0 - 21
tests/Unit/CustomerLogTest.php

@@ -1,21 +0,0 @@
-<?php
-
-
-use App\CustomerLog;
-use Illuminate\Database\Eloquent\Relations\BelongsTo;
-use Illuminate\Foundation\Testing\RefreshDatabase;
-use Tests\TestCase;
-
-class CustomerLogTest extends TestCase
-{
-    use RefreshDatabase;
-
-    /**
-     * @test
-     */
-    public function customerLog_belongsTo_customerLogStatus()
-    {
-        $customerLog =  factory(CustomerLog::class)->create();
-        $this->assertInstanceOf(BelongsTo::class, $customerLog->customerLogStatus());
-    }
-}

+ 51 - 0
tests/Unit/StationRuleBatchService/GetBatches_shouldProcessTest.php

@@ -0,0 +1,51 @@
+<?php
+
+namespace Tests\Unit\StationRuleBatchService;
+
+use App\Batch;
+use App\Owner;
+use App\Services\BatchService;
+use App\Services\OwnerService;
+use App\Services\StationRuleBatchService;
+use App\StationRuleBatch;
+use Tests\TestCase;
+
+class GetBatches_shouldProcessTest extends TestCase
+{
+    /** @var StationRuleBatchService $service */
+    private $service;
+    /** @var BatchService $batchService */
+    private $batchService;
+    private $data = [];
+
+    public function setUp(): void
+    {
+        parent::setUp();
+        $this->service = app('StationRuleBatchService');
+        $this->batchService = app('BatchService');
+        $this->data['stationRuleBatches'] = factory(StationRuleBatch::class)
+            ->create([]);
+        $this->data['batches'] = factory(Batch::class,3)->create([
+
+        ]);
+    }
+
+    /**
+     * @test
+     */
+    public function getShopByCodeMap()
+    {
+        $shop =  $this->service->getShopByCodeMap($this->data['map']);
+        $this->assertNotNull($shop);
+        $orderHeader = $this->data['orderHeader'];
+        $owner = Owner::find($shop->first()->owner_id);
+        $this->assertEquals($owner->code,$orderHeader['customerid']);
+        $this->assertEquals($shop->first()->name,$orderHeader['issuepartyname']);
+    }
+
+    public function tearDown(): void
+    {
+        cache()->flush();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
+}