<?php

/**
 * Created by PhpStorm.
 * User: stanley-king
 * Date: 2017/4/26
 * Time: 上午11:55
 */

define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));

require_once (BASE_ROOT_PATH . '/fooder.php');
require_once (BASE_ROOT_PATH . '/helper/third_author/wxauthor.php');
require_once (BASE_ROOT_PATH . '/helper/third_author/signaturer.php');
require_once (BASE_ROOT_PATH . '/helper/login_helper.php');

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

    public function testWxauthor()
    {
        $author = new thrid_author\wxauthor();
        $author->enter();
    }
    public function testOnbind()
    {
        login_helper::onBinded('18911779278','3568');
    }
    public function testOrigin()
    {
        $val = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Mobile/14C92 MicroMessenger/6.5.7 NetType/WIFI Language/zh_CN';
        $pos = strpos($val,"MicroMessenger");
    }

    public function testSignature()
    {
        thrid_author\signaturer::instance()->signurl("http://p.lrlz.com");
    }
    public function testOption()
    {
        $setting = 'a:8:{s:10:"home_title";s:0:"";s:5:"image";s:87:"http://lrlz-image.oss-cn-shenzhen.aliyuncs.com/957DBC63-6D1D-41BD-AD43-7F6E3162EE02.jpg";s:9:"show_type";s:5:"image";s:9:"show_data";s:87:"http://lrlz-image.oss-cn-shenzhen.aliyuncs.com/957DBC63-6D1D-41BD-AD43-7F6E3162EE02.jpg";s:4:"type";s:0:"";s:4:"data";s:0:"";s:5:"title";s:0:"";s:8:"reserved";s:0:"";}';
        $ssetting = unserialize($setting);
        $sjson = '{
                        "home_title":"",
                        "image":"http://lrlz-image.oss-cn-shenzhen.aliyuncs.com/FD9CFCF4-6F48-4E6E-A075-7A8C52E6416F.jpg",
                        "show_type":"image",
                        "show_data":"http://lrlz-image.oss-cn-shenzhen.aliyuncs.com/FD9CFCF4-6F48-4E6E-A075-7A8C52E6416F.jpg",
                        "type":"",
                        "data":"",
                        "title":"",
                        "reserved":""
                    }';
        $sjson = json_decode($sjson,true);
        $setting = serialize($sjson);

        $dsetting = unserialize($setting);
    }
}
