|
|
@@ -16,6 +16,9 @@ class PushOrderUpdateCacheTest extends TestCase
|
|
|
/** @var OrderService $service */
|
|
|
public $service;
|
|
|
public $data;
|
|
|
+ private $renewal_list;
|
|
|
+ private $hasKey;
|
|
|
+ private $prefixKey;
|
|
|
public function setUp(): void
|
|
|
{
|
|
|
parent::setUp(); // TODO: Change the autogenerated stub
|
|
|
@@ -28,6 +31,9 @@ class PushOrderUpdateCacheTest extends TestCase
|
|
|
$list[] = $orderHeader;
|
|
|
}
|
|
|
$this->data['OrderHeader'] = $list;
|
|
|
+ $this->renewal_list = config('sync.order_sync.cache_prefix.renewal_list');
|
|
|
+ $this->hasKey = config('sync.order_sync.cache_prefix.renewal_has');
|
|
|
+ $this->prefixKey = config('sync.order_sync.cache_prefix.renewal');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -35,16 +41,12 @@ class PushOrderUpdateCacheTest extends TestCase
|
|
|
*/
|
|
|
public function pushOrderUpdateCache()
|
|
|
{
|
|
|
- $renewal_list = config('sync.order_sync.cache_prefix.renewal_list');
|
|
|
- $hasKey = config('sync.order_sync.cache_prefix.renewal_has');
|
|
|
- $prefixKey = config('sync.order_sync.cache_prefix.renewal');
|
|
|
-
|
|
|
- $this->service->pushOrderCache($this->data['OrderHeader'],$prefixKey,$hasKey,$renewal_list);
|
|
|
+ $this->service->pushOrderCache($this->data['OrderHeader'],$this->prefixKey,$this->hasKey,$this->renewal_list);
|
|
|
try {
|
|
|
- Cache::get($hasKey);
|
|
|
- $this->assertNotNull(Cache::get($hasKey));
|
|
|
+ Cache::get($this->hasKey);
|
|
|
+ $this->assertNotNull(Cache::get($this->hasKey));
|
|
|
foreach ($this->data['OrderHeader'] as $datum) {
|
|
|
- $this->assertNotEmpty(Cache::get($prefixKey.$datum->orderno));
|
|
|
+ $this->assertNotEmpty(Cache::get($this->prefixKey.$datum->orderno));
|
|
|
}
|
|
|
$this->assertNotNull($this->data['OrderHeader']);
|
|
|
} catch (\Exception $e) {
|
|
|
@@ -56,10 +58,10 @@ class PushOrderUpdateCacheTest extends TestCase
|
|
|
public function tearDown(): void
|
|
|
{
|
|
|
try {
|
|
|
- Cache::forget('order_newest_cache_keys');
|
|
|
- Cache::forget('order_newest_has_set');
|
|
|
+ Cache::forget($this->renewal_list);
|
|
|
+ Cache::forget($this->hasKey);
|
|
|
foreach ($this->data['OrderHeader'] as $item) {
|
|
|
- Cache::forget('order_newest_' . $item->orderno);
|
|
|
+ Cache::forget($this->prefixKey . $item->orderno);
|
|
|
}
|
|
|
} catch (\Exception $e) {
|
|
|
}
|