Пример #1
0
 public function loaderTest()
 {
     //测试是否自动加载Lyc\Db\Connect类
     require_once __DIR__ . '/../Lyc/Loader/Autoloader.class.php';
     //新增项目空间
     $auto = Autoloader::getInstance();
     $auto->proDir(__DIR__ . '/RouteTest/mod/');
     //正确
     $this->assertEqual(new Index(), 'App\\Ctr\\Index');
     //正确
     $this->assertEqual(new Connect(), 'Lyc\\Db\\Connect');
     //错误
     $this->assertEqual(new Connect(), 'Lyc\\Dbb\\Connect');
 }
Пример #2
0
<?php

/*  Copyright (C) 2014 apoyl.com. All Rights Reversed.
    /*  Author:凹凸曼
    /*  Email: jar-c@163.com  
    /*  Url测试类 Test\UrlTest.class.php
    */
namespace Test;

use Lyc\Url\Url;
use Lyc\Loader\Autoloader;
require_once __DIR__ . '/../Lyc/Loader/Autoloader.class.php';
Autoloader::getInstance();
class UrlTest extends LycTest
{
    public function __construct()
    {
        parent::__construct($this);
    }
    //测试post请求,抓取页面
    public function postTest()
    {
        //测试默认、curl、sock类抓取页面
        $url = Url::getInstance();
        //$url=Url::getInstance('curl');
        //$url=Url::getInstance('sock');
        //设置代理
        //$proxy=array('host'=>'请填写代理服务器');
        //$url->setProxy($proxy);
        $data = $url->post("http://www.apoyl.com", array('paged' => 1));
        $this->assertEqual($url->getCode(), 200);