<?php

namespace Tests\Video\Http\Controllers;

use Modules\Video\Http\Controllers\JuliangAccountController;
use PHPUnit\Framework\TestCase;
use Tests\UsedTestCase;

class VideoControllerTest extends UsedTestCase
{

    public function testAdd()
    {
        $data = [
            'name' => 'test1-112',
            'total_episode_num' => 10,
            'update_type' => 1,
            'category_id' => 4,
            'shelf_type' => 2,
            'd_charge_sequence' => 3,
            'd_charge_coin' => 10,
            'cp_name' => 'kanshu1',
            'cp_share_type' => 1,
            'cover_image' => 'https://www.baidu.com'
        ];

        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/videoStock/video/add', $data);

        $this->dumpJson($res);
    }

    public function testUpdate() {
        $data = [
            'name' => 'test1-114',
            'total_episode_num' => 10,
            'update_type' => 2,
            'category_id' => 4,
            'shelf_type' => 1,
            'd_charge_sequence' => 3,
            'd_charge_coin' => 10,
            'cp_name' => 'kanshu1',
            'cp_share_type' => 1,
            'cover_image' => 'https://www.baidu.com',
            'id' => 2,
        ];

        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/videoStock/video/update', $data);
        $this->dumpJson($res);
    }

    public function testList() {
        $query = [
            'operateUserId' => null,
        ];
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('get','http://localhost/api/videoStock/video/list', [
//            'videoName' => '112',
//        'updateType' => 2,
//        'categoryId' => 4,
//            'operateUserId' =>10
            'wechatPass' => ''
        ]);
//        $this->dumpJson($res);
        $res->dump();
    }

    public function testsetChargeConfig() {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/videoStock/video/setChargeConfig',[
            'id' => 1,
            'chargeCoin' => 67,
            'chargeType' => 1,
            'chargeSequence' => 23
        ]);
        $res->dump();
    }
}