<?php

namespace Tests\Tuiguang\Http\Controllers;

use Modules\Tuiguang\Http\Controllers\PromotionController;
use PHPUnit\Framework\TestCase;
use Tests\UsedTestCase;

class PromotionControllerTest extends UsedTestCase
{

    public function testAdd()
    {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/tuiguang/promotion/add', [
            'video_id' => 6,
            'series_sequence'  => 4,
            'name' => 'kkkkddd的发的',
            'miniprogram_id' => 2,
            'first_charge_template_id' => 1,
            'not_first_charge_template_id' => 2
        ]);

        $res->dump();
    }

    public function testDelete()
    {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/tuiguang/promotion/delete', [
            'id' => 1
        ]);

        $res->dump();
    }


    public function testupdateSeriesSequence()
    {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/tuiguang/promotion/updateSeriesSequence', [
            'id' => 136,
            'series_sequence' => 5,
            'remark' => '',
            'first_charge_template_id' => 1,
            'not_first_charge_template_id' => 2
        ]);

        $res->dump();
    }

    public function testList()
    {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('get','http://localhost/api/tuiguang/promotion/list', [
//            'is_config' => 0,
//            'name' => 'kkk'
        ]);

        $res->dump();
//        $this->dumpJson($res);
    }

    public function testupdateCallbackConfig() {
        $res = $this->withHeaders([
            'Authorization' => 'Bearer '. $this->token,
        ])->json('post','http://localhost/api/tuiguang/promotion/updateCallbackConfig', [
            'id' => 2,
            'callback_type' => 1,
            'callback_config_id' => 4
        ]);

        $res->dump();

    }
}
