<?php

/**
 * Created by PhpStorm.
 * User: stanley-king
 * Date: 2017/4/6
 * Time: 下午2:42
 */
define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));

require_once(BASE_ROOT_PATH . '/fooder.php');
require_once(BASE_ROOT_PATH . '/helper/fcode/generator.php');
require_once(BASE_ROOT_PATH . '/helper/fcode/operator.php');
require_once(BASE_ROOT_PATH . '/helper/fcode/mfcode.php');
require_once(BASE_ROOT_PATH . '/helper/fcode/present_manager.php');
require_once(BASE_ROOT_PATH . '/helper/fcode/send_manager.php');
require_once(BASE_ROOT_PATH . '/helper/notify_helper.php');


class TestFcode extends PHPUnit_Framework_TestCase
{
    public static function setUpBeforeClass()
    {
        Base::run_util();
    }

    public function testManager()
    {
        $manager = fcode\present_manager::instance();
    }

    public function testSendManager()
    {
        $manager = fcode\send_manager::instance();
        $manager->fetch(600,1);
    }

    public function testGenerate()
    {
        $gen = new fcode\generator(24,10,'HSDX01',10);
        $url = $gen->make();
    }

    public function testGrab()
    {
//        $oper = new fcode\operator(24,0);
//        $fcode = $oper->grab();
    }

    public function testPrefix()
    {
        $mod_fcode = Model('goods_fcode');
        $result = $mod_fcode->where(array('fc_code' => 'NWY818729'))->find();

        $fcode = new fcode\mfcode('NWY818729');
        $code = sprintf("%06s",'DLHS');
    }

    public function testWarning()
    {
        notify_helper::onFcodeWarning();
    }
}
