| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace LaborReportsCountingRecordService;
- use App\Services\LaborReportsCountingRecordService;
- use Illuminate\Support\Facades\Cache;
- use Tests\TestCase;
- class ByCacheTest extends TestCase
- {
- /** @var LaborReportsCountingRecordService $laborReportsCountingRecordService */
- public $laborReportsCountingRecordService;
- public function setUp(): void
- {
- parent::setUp();
- $this->laborReportsCountingRecordService = new LaborReportsCountingRecordService();
- }
- public function testSet()
- {
- $start = '2025-10-01';
- $end = '2025-10-05';
- $dateList = [
- '2025-10-01',
- '2025-10-02',
- '2025-10-03',
- '2025-10-04',
- '2025-10-05',
- ];
- $unit = '日';
- foreach ($dateList as $date) {
- $key = 'laborReportsCountingRecords_' . $date . '_' . $unit;
- Cache::put($key, '111111111111');
- }
- $result = $this->laborReportsCountingRecordService->getByCache($start,$end, $unit);
- self::assertTrue($result['dataList']->isnotEmpty());
- self::assertTrue($result['dateList'] == []);
- }
- }
|