| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace Tests\Services\CommodityService;
- use App\Services\OrderService;
- use App\Services\StoreService;
- use App\ValueStore;
- use Carbon\Carbon;
- use Illuminate\Foundation\Testing\RefreshDatabase;
- use Illuminate\Foundation\Testing\WithFaker;
- use Illuminate\Support\Str;
- use Tests\TestCase;
- class SetAsnSyncAtTest extends TestCase
- {
- /** @var StoreService $service */
- private $service;
- private $created_at;
- private $original_value;
- public function setUp(): void
- {
- parent::setUp(); // TODO: Change the autogenerated stub
- $this->service = app(StoreService::class);
- $this->created_at = config('sync.asn_sync.created_at');
- }
- /**
- * @test
- */
- public function testSetAsnSyncAt()
- {
- /** @var Carbon $time */
- $data = Carbon::now();
- $this->original_value=ValueStore::query()->where('name',$this->created_at)->value('value');
- $this->service->setAsnLastSyncAt($this->created_at,$data);
- $value=ValueStore::query()->where('name',$this->created_at)->value('value');
- $this->assertEquals((string)$data,(string)$value);
- }
- public function tearDown(): void
- {
- ValueStore::query()->updateOrCreate([
- 'name' => $this->created_at,
- ], [
- 'name' => $this->created_at,
- 'value' => $this->original_value,
- ]);
- parent::tearDown(); // TODO: Change the autogenerated stub
- }
- }
|