<?php

namespace Tests\Operation\Http\Controllers;

use Modules\Operation\Http\Controllers\FirstPageController;
use PHPUnit\Framework\TestCase;
use Tests\UsedTestCase;

class FirstPageControllerTest extends UsedTestCase
{

    public function testAdd()
    {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/operationManage/firstPage/add', [
            'type' => 1,
            'status' => 0,
        ]);
        $this->dumpJson($res);
    }
    public function testList()
    {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('get','http://localhost/api/operationManage/firstPage/list');
        $res->dump();
        $this->dumpJson($res);
    }

    public function testEnableStatus()
    {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/operationManage/firstPage/enableStatus', [
            'id' => 4,
        ]);
        $res->dump();
        $this->dumpJson($res);
    }

    public function testsetConfig()
    {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/operationManage/firstPage/setConfig', [
            'id' => 4,
            'duanjus' => [
                [
                    'sort' => 5,
                    'id' => 9,
                    'name' => 'xxx1',
                ],
                [
                    'sort' => 1,
                    'id' =>10,
                    'name' => 'xxx2',
                ],[
                    'sort' => 3,
                    'id' =>11,
                    'name' => 'xxx3',
                ],[
                    'sort' => 4,
                    'id' =>12,
                    'name' => 'xxx4',
                ],
            ]
        ]);
        $res->dump();
        $this->dumpJson($res);
    }


}