<?php

namespace Tests\Services\OrderIssueService;

use App\OrderIssue;
use App\Services\OrderIssueService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;

class GetRecycleBinPaginateTest extends TestCase
{
    /**
     * @var OrderIssueService $service
     */
    public $service;
    public $data = [];
    public function setUp(): void
    {
        parent::setUp(); // TODO: Change the autogenerated stub
        $this->service = app('OrderIssueService');
        $orderIssues = $this->service->getRecycleBinPaginate([]);
        if($orderIssues->count() == 0){
            $orderIssue = OrderIssue::query()->create([
                'is_new_rejecting' => '无',
                'rejecting_status' => '无',
                'imported_status' => '正常',
            ]);
            $data['orderIssue'] = $orderIssue;
            $orderIssue->delete();
        }
    }

    public function testGetRecycleBinPaginate()
    {
        $orderIssue = $this->service->getRecycleBinPaginate([]);
        $this->assertNotEmpty($orderIssue);
        if(isset($data['orderIssue'])){
            $data['orderIssue']->delete();
        }
    }
}
