<?php

/**
 * TestCommonHandler.php
 * 文件描述
 * Created On 2022/3/8
 * @author yuanb yuanbo0x@gmail.com
 */

namespace Test\DB;

use Framework\DB\Handler\CommonDBHandler;
use Game\Constant\DBTableDefine;
use Game\Constant\ModelTypeDefine;
use Test\TestBase;

class TestCommonHandler extends TestBase
{
    use CommonDBHandler;

    public function getPlayerId(): int
    {
        return 0;
    }

    public function startTest()
    {
        /*
         function logger($fileName)
         {
             $fileHandle = fopen($fileName, 'a');
             while (true) {
                 fwrite($fileHandle, yield . "\n");
             }
         }

         $logger = logger(__DIR__ . '/log');
         $logger->send('Foo');
         $logger->send('Bar');
        */


        $result = array();
        $ret = $this->searchTermMultiCommon(
            $result,
            DBTableDefine::TABLE_COMMON,
            1,
            array("a1", "vb1", "yb02")
        );

        echo json_encode($result) . "<br>";

        $num = 0;
        $ret = $this->autoAddCommonTerm(
            $num,
            DBTableDefine::TABLE_COMMON,
            1,
            "sd",
            3
        );
        echo $num . "<br>";

        $num1 = 0;
        $ret = $this->delTermMultiCommon(
            $num1,
            DBTableDefine::TABLE_COMMON,
            1,
            array("", "0001", "11")
        );
    }
}
