bianjunhui преди 2 години
родител
ревизия
64bd59c9e4
променени са 100 файла, в които са добавени 1652 реда и са изтрити 6204 реда
  1. 5 11
      thinkphp/tests/mock.php
  2. 7 8
      composer.json
  3. 78 33
      thinkphp/README.md
  4. 1 1
      thinkphp/composer.json
  5. 3 3
      thinkphp/library/think/App.php
  6. 29 29
      thinkphp/library/think/Db.php
  7. 1 1
      thinkphp/library/think/Lang.php
  8. 6 6
      thinkphp/library/think/Log.php
  9. 2 2
      thinkphp/library/think/cache/driver/Redis.php
  10. 2 8
      thinkphp/library/think/db/Builder.php
  11. 1 1
      thinkphp/library/think/db/Query.php
  12. 1 1
      thinkphp/library/think/session/driver/Redis.php
  13. 0 4
      thinkphp/tests/.gitignore
  14. 0 132
      thinkphp/tests/README.md
  15. 0 33
      thinkphp/tests/application/config.php
  16. 0 44
      thinkphp/tests/application/database.php
  17. 0 10
      thinkphp/tests/application/index/controller/Index.php
  18. 0 22
      thinkphp/tests/application/route.php
  19. 0 1
      thinkphp/tests/application/views/display.html
  20. 0 1
      thinkphp/tests/application/views/display.phtml
  21. 0 2
      thinkphp/tests/application/views/extend.html
  22. 0 17
      thinkphp/tests/application/views/extend2.html
  23. 0 2
      thinkphp/tests/application/views/include.html
  24. 0 1
      thinkphp/tests/application/views/include2.html
  25. 0 2
      thinkphp/tests/application/views/layout.html
  26. 0 2
      thinkphp/tests/application/views/layout2.html
  27. 0 1
      thinkphp/tests/conf/memcached.ini
  28. 0 1
      thinkphp/tests/conf/redis.ini
  29. 0 1
      thinkphp/tests/conf/timezone.ini
  30. 0 13
      thinkphp/tests/script/install.sh
  31. 0 39
      thinkphp/tests/thinkphp/baseTest.php
  32. 0 90
      thinkphp/tests/thinkphp/library/think/appTest.php
  33. 0 15
      thinkphp/tests/thinkphp/library/think/behavior/One.php
  34. 0 9
      thinkphp/tests/thinkphp/library/think/behavior/Three.php
  35. 0 9
      thinkphp/tests/thinkphp/library/think/behavior/Two.php
  36. 0 73
      thinkphp/tests/thinkphp/library/think/buildTest.php
  37. 0 207
      thinkphp/tests/thinkphp/library/think/cache/driver/cacheTestCase.php
  38. 0 46
      thinkphp/tests/thinkphp/library/think/cache/driver/fileTest.php
  39. 0 69
      thinkphp/tests/thinkphp/library/think/cache/driver/liteTest.php
  40. 0 49
      thinkphp/tests/thinkphp/library/think/cache/driver/memcacheTest.php
  41. 0 72
      thinkphp/tests/thinkphp/library/think/cache/driver/memcachedTest.php
  42. 0 66
      thinkphp/tests/thinkphp/library/think/cache/driver/redisTest.php
  43. 0 315
      thinkphp/tests/thinkphp/library/think/cacheTest.php
  44. 0 52
      thinkphp/tests/thinkphp/library/think/config/ConfigInitTrait.php
  45. 0 1
      thinkphp/tests/thinkphp/library/think/config/driver/fixtures/config.ini
  46. 0 1
      thinkphp/tests/thinkphp/library/think/config/driver/fixtures/config.json
  47. 0 6
      thinkphp/tests/thinkphp/library/think/config/driver/fixtures/config.xml
  48. 0 36
      thinkphp/tests/thinkphp/library/think/config/driver/iniTest.php
  49. 0 36
      thinkphp/tests/thinkphp/library/think/config/driver/jsonTest.php
  50. 0 36
      thinkphp/tests/thinkphp/library/think/config/driver/xmlTest.php
  51. 0 149
      thinkphp/tests/thinkphp/library/think/configTest.php
  52. 0 2
      thinkphp/tests/thinkphp/library/think/controller/.gitignore
  53. 0 194
      thinkphp/tests/thinkphp/library/think/controllerTest.php
  54. 0 150
      thinkphp/tests/thinkphp/library/think/cookieTest.php
  55. 0 2
      thinkphp/tests/thinkphp/library/think/db/driver/.gitignore
  56. 0 352
      thinkphp/tests/thinkphp/library/think/dbTest.php
  57. 0 220
      thinkphp/tests/thinkphp/library/think/debugTest.php
  58. 0 52
      thinkphp/tests/thinkphp/library/think/exceptionTest.php
  59. 0 67
      thinkphp/tests/thinkphp/library/think/hookTest.php
  60. 0 4
      thinkphp/tests/thinkphp/library/think/lang/lang.php
  61. 0 76
      thinkphp/tests/thinkphp/library/think/langTest.php
  62. 0 7
      thinkphp/tests/thinkphp/library/think/loader/test/Hello.php
  63. 0 71
      thinkphp/tests/thinkphp/library/think/loaderTest.php
  64. 0 34
      thinkphp/tests/thinkphp/library/think/log/driver/fileTest.php
  65. 0 39
      thinkphp/tests/thinkphp/library/think/logTest.php
  66. 0 2
      thinkphp/tests/thinkphp/library/think/model/.gitignore
  67. 0 40
      thinkphp/tests/thinkphp/library/think/paginateTest.php
  68. 0 203
      thinkphp/tests/thinkphp/library/think/requestTest.php
  69. 0 95
      thinkphp/tests/thinkphp/library/think/responseTest.php
  70. 0 287
      thinkphp/tests/thinkphp/library/think/routeTest.php
  71. 0 2
      thinkphp/tests/thinkphp/library/think/session/.gitignore
  72. 0 319
      thinkphp/tests/thinkphp/library/think/sessionTest.php
  73. 0 2
      thinkphp/tests/thinkphp/library/think/template/driver/.gitignore
  74. 0 575
      thinkphp/tests/thinkphp/library/think/template/taglib/cxTest.php
  75. 0 415
      thinkphp/tests/thinkphp/library/think/templateTest.php
  76. 0 129
      thinkphp/tests/thinkphp/library/think/urlTest.php
  77. 0 200
      thinkphp/tests/thinkphp/library/think/validateTest.php
  78. 0 2
      thinkphp/tests/thinkphp/library/think/view/driver/.gitignore
  79. 0 14
      thinkphp/tests/thinkphp/library/think/view/theme/index/template.html
  80. 0 76
      thinkphp/tests/thinkphp/library/think/viewTest.php
  81. 0 339
      thinkphp/tests/thinkphp/library/traits/controller/jumpTest.php
  82. 0 179
      thinkphp/tests/thinkphp/library/traits/model/softDeleteTest.php
  83. 0 60
      thinkphp/tests/thinkphp/library/traits/think/instanceTest.php
  84. 0 18
      vendor/autoload.php
  85. 7 9
      vendor/composer/InstalledVersions.php
  86. 2 2
      vendor/composer/autoload_classmap.php
  87. 1 1
      vendor/composer/autoload_files.php
  88. 1 1
      vendor/composer/autoload_namespaces.php
  89. 4 3
      vendor/composer/autoload_psr4.php
  90. 27 4
      vendor/composer/autoload_real.php
  91. 13 5
      vendor/composer/autoload_static.php
  92. 860 105
      vendor/composer/installed.json
  93. 83 76
      vendor/composer/installed.php
  94. 2 2
      vendor/composer/platform_check.php
  95. 105 0
      vendor/firebase/php-jwt/CHANGELOG.md
  96. 30 0
      vendor/firebase/php-jwt/LICENSE
  97. 332 0
      vendor/firebase/php-jwt/README.md
  98. 42 0
      vendor/firebase/php-jwt/composer.json
  99. 7 0
      vendor/firebase/php-jwt/src/BeforeValidException.php
  100. 0 0
      vendor/firebase/php-jwt/src/CachedKeySet.php

+ 5 - 11
thinkphp/tests/mock.php

@@ -1,20 +1,14 @@
 <?php
 // +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
 // +----------------------------------------------------------------------
 // | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
 // +----------------------------------------------------------------------
 // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
 // +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
+// | Author: yunwuxin <448901948@qq.com>
 // +----------------------------------------------------------------------
 
-// 测试入口文件
-$_SERVER['REQUEST_METHOD'] = 'GET';
-// 定义项目测试基础路径
-define('TEST_PATH', __DIR__ . '/');
-// 定义项目路径
-define('APP_PATH', __DIR__ . '/application/');
-// 加载框架基础文件
-require __DIR__ . '/../base.php';
-\think\Loader::addNamespace('tests', TEST_PATH);
+return [
+    'connector' => 'Sync'
+];

+ 7 - 8
composer.json

@@ -30,15 +30,14 @@
         "ext-curl": "*",
         "ext-pdo": "*",
         "ext-bcmath": "*",
-        "txthinking/mailer": "^2.0"
+        "txthinking/mailer": "^2.0",
+        "firebase/php-jwt": "^6.4"
     },
     "config": {
-        "preferred-install": "dist"
-    },
-    "repositories": [
-        {
-            "type": "git",
-            "url": "https://gitee.com/fastadminnet/framework.git"
+        "preferred-install": "dist",
+        "allow-plugins": {
+            "topthink/think-installer": true,
+            "easywechat-composer/easywechat-composer": true
         }
-    ]
+    }
 }

+ 78 - 33
thinkphp/README.md

@@ -1,37 +1,15 @@
-# ThinkPHP 5.0(FastAdmin 团队长期维护)
+ThinkPHP 5.0
+===============
 
-## 维护原因
+[![StyleCI](https://styleci.io/repos/48530411/shield?style=flat&branch=master)](https://styleci.io/repos/48530411)
+[![Build Status](https://travis-ci.org/top-think/framework.svg?branch=master)](https://travis-ci.org/top-think/framework)
+[![codecov.io](http://codecov.io/github/top-think/framework/coverage.svg?branch=master)](http://codecov.io/github/github/top-think/framework?branch=master)
+[![Total Downloads](https://poser.pugx.org/topthink/framework/downloads)](https://packagist.org/packages/topthink/framework)
+[![Latest Stable Version](https://poser.pugx.org/topthink/framework/v/stable)](https://packagist.org/packages/topthink/framework)
+[![Latest Unstable Version](https://poser.pugx.org/topthink/framework/v/unstable)](https://packagist.org/packages/topthink/framework)
+[![License](https://poser.pugx.org/topthink/framework/license)](https://packagist.org/packages/topthink/framework)
 
-FastAdmin 致力于服务开发者,为开发者节省时间,为了 FastAdmin 开源项目持续发展下去。
-
-## 参与开源
-
-[贡献代码](https://doc.fastadmin.net/doc/contributing.html)
-
-
-## 使用方法
-
-- 本框架已经应用在 FastAdmin 后台框架中,在 FastAdmin 项目中使用 `composer update topthink/framework -vvv` 命令即可更新。
-
-- 非 FastAdmin 的 ThinkPHP5.0 项目使用此仓库,请修改 `composer.json` 添加以下配置,在执行`composer update topthink/framework -vvv` 命令,具体可以参考 FastAdmin 项目目录下的 `composer.json` 文件内容。
-    ```
-    "repositories": [
-        {
-            "type": "git",
-            "url": "https://gitee.com/fastadminnet/framework.git"
-        }
-    ]
-    ```
-
-## 环境要求
-
-php 7.1+
-
-
-
-## ThinkPHP 介绍
-
-ThinkPHP5 在保持快速开发和大道至简的核心理念不变的同时,优化核心,减少依赖,基于全新的架构思想和命名空间实现,是 ThinkPHP 突破原有框架思路的颠覆之作,其主要特性包括:
+ThinkPHP5在保持快速开发和大道至简的核心理念不变的同时,PHP版本要求提升到5.4,优化核心,减少依赖,基于全新的架构思想和命名空间实现,是ThinkPHP突破原有框架思路的颠覆之作,其主要特性包括:
 
  + 基于命名空间和众多PHP新特性
  + 核心功能组件化
@@ -52,15 +30,82 @@ ThinkPHP5 在保持快速开发和大道至简的核心理念不变的同时,
  + 支持Composer
  + 支持MongoDb
 
+> ThinkPHP5的运行环境要求PHP5.4以上。
+
 详细开发文档参考 [ThinkPHP5完全开发手册](http://www.kancloud.cn/manual/thinkphp5) 以及[ThinkPHP5入门系列教程](http://www.kancloud.cn/special/thinkphp5_quickstart)
 
+## 目录结构
+
+初始的目录结构如下:
+
+~~~
+www  WEB部署目录(或者子目录)
+├─application           应用目录
+│  ├─common             公共模块目录(可以更改)
+│  ├─module_name        模块目录
+│  │  ├─config.php      模块配置文件
+│  │  ├─common.php      模块函数文件
+│  │  ├─controller      控制器目录
+│  │  ├─model           模型目录
+│  │  ├─view            视图目录
+│  │  └─ ...            更多类库目录
+│  │
+│  ├─command.php        命令行工具配置文件
+│  ├─common.php         公共函数文件
+│  ├─config.php         公共配置文件
+│  ├─route.php          路由配置文件
+│  ├─tags.php           应用行为扩展定义文件
+│  └─database.php       数据库配置文件
+│
+├─public                WEB目录(对外访问目录)
+│  ├─index.php          入口文件
+│  ├─router.php         快速测试文件
+│  └─.htaccess          用于apache的重写
+│
+├─thinkphp              框架系统目录
+│  ├─lang               语言文件目录
+│  ├─library            框架类库目录
+│  │  ├─think           Think类库包目录
+│  │  └─traits          系统Trait目录
+│  │
+│  ├─tpl                系统模板目录
+│  ├─base.php           基础定义文件
+│  ├─console.php        控制台入口文件
+│  ├─convention.php     框架惯例配置文件
+│  ├─helper.php         助手函数文件
+│  ├─phpunit.xml        phpunit配置文件
+│  └─start.php          框架入口文件
+│
+├─extend                扩展类库目录
+├─runtime               应用的运行时目录(可写,可定制)
+├─vendor                第三方类库目录(Composer依赖库)
+├─build.php             自动生成定义文件(参考)
+├─composer.json         composer 定义文件
+├─LICENSE.txt           授权说明文件
+├─README.md             README 文件
+├─think                 命令行入口文件
+~~~
+
+> router.php用于php自带webserver支持,可用于快速测试
+> 切换到public目录后,启动命令:php -S localhost:8888  router.php
+> 上面的目录结构和名称是可以改变的,这取决于你的入口文件和配置参数。
+
+## 命名规范
+
+ThinkPHP5的命名规范遵循`PSR-2`规范以及`PSR-4`自动加载规范。
+
+## 参与开发
+注册并登录 Github 帐号, fork 本项目并进行改动。
+
+更多细节参阅 [CONTRIBUTING.md](CONTRIBUTING.md)
+
 ## 版权信息
 
 ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
 
 本项目包含的第三方源码和二进制文件之版权信息另行标注。
 
-版权所有Copyright © 2006-2022 by ThinkPHP (http://thinkphp.cn)
+版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn)
 
 All rights reserved。
 

+ 1 - 1
thinkphp/composer.json

@@ -16,7 +16,7 @@
         }
     ],
     "require": {
-        "php": ">=7.1.0",
+        "php": ">=5.4.0",
         "topthink/think-installer": "~1.0"
     },
     "require-dev": {

+ 3 - 3
thinkphp/library/think/App.php

@@ -400,10 +400,10 @@ class App
     private static function getParamValue($param, &$vars, $type)
     {
         $name  = $param->getName();
-        $reflectionType = $param->getType();
+        $class = $param->getClass();
 
-        if ($reflectionType && $reflectionType->isBuiltin() === false) {
-            $className = $reflectionType->getName();
+        if ($class) {
+            $className = $class->getName();
             $bind      = Request::instance()->$name;
 
             if ($bind instanceof $className) {

+ 29 - 29
thinkphp/library/think/Db.php

@@ -17,35 +17,35 @@ use think\db\Query;
 /**
  * Class Db
  * @package think
- * @method static Query table(string $table) 指定数据表(含前缀)
- * @method static Query name(string $name) 指定数据表(不含前缀)
- * @method static Query where(mixed $field, string $op = null, mixed $condition = null) 查询条件
- * @method static Query join(mixed $join, mixed $condition = null, string $type = 'INNER') JOIN查询
- * @method static Query union(mixed $union, boolean $all = false) UNION查询
- * @method static Query limit(mixed $offset, integer $length = null) 查询LIMIT
- * @method static Query order(mixed $field, string $order = null) 查询ORDER
- * @method static Query cache(mixed $key = null , integer $expire = null) 设置查询缓存
- * @method static mixed value(string $field) 获取某个字段的值
- * @method static array column(string $field, string $key = '') 获取某个列的值
- * @method static Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') 视图查询
- * @method static mixed find(mixed $data = null) 查询单个记录
- * @method static mixed select(mixed $data = null) 查询多个记录
- * @method static integer insert(array $data, boolean $replace = false, boolean $getLastInsID = false, string $sequence = null) 插入一条记录
- * @method static integer insertGetId(array $data, boolean $replace = false, string $sequence = null) 插入一条记录并返回自增ID
- * @method static integer insertAll(array $dataSet) 插入多条记录
- * @method static integer update(array $data) 更新记录
- * @method static integer delete(mixed $data = null) 删除记录
- * @method static boolean chunk(integer $count, callable $callback, string $column = null) 分块获取数据
- * @method static mixed query(string $sql, array $bind = [], boolean $master = false, bool $pdo = false) SQL查询
- * @method static integer execute(string $sql, array $bind = [], boolean $fetch = false, boolean $getLastInsID = false, string $sequence = null) SQL执行
- * @method static Paginator paginate(integer $listRows = 15, mixed $simple = null, array $config = []) 分页查询
- * @method static mixed transaction(callable $callback) 执行数据库事务
- * @method static void startTrans() 启动事务
- * @method static void commit() 用于非自动提交状态下面的查询提交
- * @method static void rollback() 事务回滚
- * @method static boolean batchQuery(array $sqlArray) 批处理执行SQL语句
- * @method static string quote(string $str) SQL指令安全过滤
- * @method static string getLastInsID($sequence = null) 获取最近插入的ID
+ * @method Query table(string $table) static 指定数据表(含前缀)
+ * @method Query name(string $name) static 指定数据表(不含前缀)
+ * @method Query where(mixed $field, string $op = null, mixed $condition = null) static 查询条件
+ * @method Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查询
+ * @method Query union(mixed $union, boolean $all = false) static UNION查询
+ * @method Query limit(mixed $offset, integer $length = null) static 查询LIMIT
+ * @method Query order(mixed $field, string $order = null) static 查询ORDER
+ * @method Query cache(mixed $key = null , integer $expire = null) static 设置查询缓存
+ * @method mixed value(string $field) static 获取某个字段的值
+ * @method array column(string $field, string $key = '') static 获取某个列的值
+ * @method Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 视图查询
+ * @method mixed find(mixed $data = null) static 查询单个记录
+ * @method mixed select(mixed $data = null) static 查询多个记录
+ * @method integer insert(array $data, boolean $replace = false, boolean $getLastInsID = false, string $sequence = null) static 插入一条记录
+ * @method integer insertGetId(array $data, boolean $replace = false, string $sequence = null) static 插入一条记录并返回自增ID
+ * @method integer insertAll(array $dataSet) static 插入多条记录
+ * @method integer update(array $data) static 更新记录
+ * @method integer delete(mixed $data = null) static 删除记录
+ * @method boolean chunk(integer $count, callable $callback, string $column = null) static 分块获取数据
+ * @method mixed query(string $sql, array $bind = [], boolean $master = false, bool $pdo = false) static SQL查询
+ * @method integer execute(string $sql, array $bind = [], boolean $fetch = false, boolean $getLastInsID = false, string $sequence = null) static SQL执行
+ * @method Paginator paginate(integer $listRows = 15, mixed $simple = null, array $config = []) static 分页查询
+ * @method mixed transaction(callable $callback) static 执行数据库事务
+ * @method void startTrans() static 启动事务
+ * @method void commit() static 用于非自动提交状态下面的查询提交
+ * @method void rollback() static 事务回滚
+ * @method boolean batchQuery(array $sqlArray) static 批处理执行SQL语句
+ * @method string quote(string $str) static SQL指令安全过滤
+ * @method string getLastInsID($sequence = null) static 获取最近插入的ID
  */
 class Db
 {

+ 1 - 1
thinkphp/library/think/Lang.php

@@ -211,7 +211,7 @@ class Lang
             }
         }
 
-        if (preg_match('/^([a-z0-9\-_]{2,10})$/i', $langSet, $matches)) {
+        if (preg_match('/^([a-z\d\-]+)/i', $langSet, $matches)) {
             $langSet = strtolower($matches[1]);
         } else {
             $langSet = self::$range;

+ 6 - 6
thinkphp/library/think/Log.php

@@ -17,12 +17,12 @@ use think\exception\ClassNotFoundException;
  * Class Log
  * @package think
  *
- * @method static void log($msg) 记录一般日志
- * @method static void error($msg) 记录错误日志
- * @method static void info($msg) 记录一般信息日志
- * @method static void sql($msg) 记录 SQL 查询日志
- * @method static void notice($msg) 记录提示日志
- * @method static void alert($msg) 记录报警日志
+ * @method void log($msg) static 记录一般日志
+ * @method void error($msg) static 记录错误日志
+ * @method void info($msg) static 记录一般信息日志
+ * @method void sql($msg) static 记录 SQL 查询日志
+ * @method void notice($msg) static 记录提示日志
+ * @method void alert($msg) static 记录报警日志
  */
 class Log
 {

+ 2 - 2
thinkphp/library/think/cache/driver/Redis.php

@@ -162,7 +162,7 @@ class Redis extends Driver
      */
     public function rm($name)
     {
-        return $this->handler->del($this->getCacheKey($name));
+        return $this->handler->delete($this->getCacheKey($name));
     }
 
     /**
@@ -177,7 +177,7 @@ class Redis extends Driver
             // 指定标签清除
             $keys = $this->getTagItem($tag);
             foreach ($keys as $key) {
-                $this->handler->del($key);
+                $this->handler->delete($key);
             }
             $this->rm('tag_' . md5($tag));
             return true;

+ 2 - 8
thinkphp/library/think/db/Builder.php

@@ -386,7 +386,7 @@ abstract class Builder
                     $array[] = $key . ' ' . $exp . ' ' . $this->parseValue($item, $field);
                 }
                 $logic = isset($val[2]) ? $val[2] : 'AND';
-                $whereStr .= '(' . implode(' ' . strtoupper($logic) . ' ', $array) . ')';
+                $whereStr .= '(' . implode($array, ' ' . strtoupper($logic) . ' ') . ')';
             } else {
                 $whereStr .= $key . ' ' . $exp . ' ' . $this->parseValue($value, $field);
             }
@@ -541,18 +541,12 @@ abstract class Builder
      * @param array $options 查询条件
      * @return string
      */
-    protected function parseJoin($join, & $options = [])
+    protected function parseJoin($join, $options = [])
     {
         $joinStr = '';
         if (!empty($join)) {
             foreach ($join as $item) {
                 list($table, $type, $on) = $item;
-                if (is_array($table)) {
-                    $origin = key($table);
-                    if ($origin && $origin != $table[$origin]) {
-                        $options['alias'][$origin] = $table[$origin];
-                    }
-                }
                 $condition               = [];
                 foreach ((array) $on as $val) {
                     if ($val instanceof Expression) {

+ 1 - 1
thinkphp/library/think/db/Query.php

@@ -397,7 +397,7 @@ class Query
                         $seq = (ord(substr($type($value), 0, 1)) % $rule['num']) + 1;
                     } else {
                         // 按照字段的首字母的值分表
-                        $seq = (ord($value[0]) % $rule['num']) + 1;
+                        $seq = (ord($value{0}) % $rule['num']) + 1;
                     }
             }
             return $this->getTable() . '_' . $seq;

+ 1 - 1
thinkphp/library/think/session/driver/Redis.php

@@ -112,7 +112,7 @@ class Redis extends SessionHandler
      */
     public function destroy($sessID)
     {
-        return $this->handler->del($this->config['session_name'] . $sessID) > 0;
+        return $this->handler->delete($this->config['session_name'] . $sessID) > 0;
     }
 
     /**

+ 0 - 4
thinkphp/tests/.gitignore

@@ -1,4 +0,0 @@
-/runtime/
-/application/common.php
-/application/demo/
-/application/runtime/

+ 0 - 132
thinkphp/tests/README.md

@@ -1,132 +0,0 @@
-## 测试目录结构
-
-测试文件主要在 tests 文件下面,主要有以下几个文件夹
-
-- conf 测试环境配置文件。
-- script 测试环境配置脚本。
-- thinkphp 测试用例和相关文件,与项目文件夹结构一致。
-- mock.php 测试入口文件。
-
-## 主要测试流程
-
-thinkphp5 的测试的主要流程是跟 thinkphp 的系统流程是相似的,大体的流程为:
-
-1. 引用 mock.php 文件加载框架
-
-2. 根据文件目录,添加测试文件
-
-3. 执行单元测试,输出结果
-
-## 测试举例
-
-例如测试 thinkphp 里的 apc 缓存,将分为以下几个过程:
-
-1. 创建 apcTest.php 文件
-
-该文件应与 apc.php 目录路径 `thinkphp/library/think/cache/driver` 一致,命名空间与目录所在一致,并引用 `PHPUnit_Framework_TestCase`。
-
-  ```php
-  <?php
-
-  namespace tests\thinkphp\library\think\cache\driver;
-
-  class apcTest extends \PHPUnit_Framework_TestCase
-  {
-      //设定基境
-      public function setUp()
-      {
-      }
-  }
-  ```
-
-2. 编写测试文件
-
-  - 引用 app、config 和 cache
-
-  ```php
-  use think\app;
-  use think\cache;
-  use think\config;
-  ```
-  - 在 setUp 函数中设定 require 条件
-
-  ```php
-  if(!extension_loaded('apc')){
-      $this->markTestSkipped('apc扩展不可用!');
-  };
-  ```
-
-  - 编写测试用例
-
-  *具体写法参照 [PHPUnit 官方文档](https://phpunit.de/manual/4.8/zh_cn/index.html)*
-
-  ```php
-  public function testGet()
-  {
-      App::run();
-      $this->assertInstanceOf(
-          '\think\cache\driver\Apc',
-          Cache::connect(['type' => 'apc', 'expire' => 1])
-      );
-      $this->assertTrue(Cache::set('key', 'value'));
-      $this->assertEquals('value', Cache::get('key'));
-      $this->assertTrue(Cache::rm('key'));
-      $this->assertFalse(Cache::get('key'));
-      $this->assertTrue(Cache::clear('key'));
-      Config::reset();
-  }
-  ```
-
-3. 执行单元测试命令
-
-  在项目根目录执行
-
-  ```bash
-  $ phpunit
-  ```
-
-  若想看到所有结果,请添加-v参数
-
-  ```bash
-  $ phpunit -v
-  ```
-
-4. 输出结果
-
-## 相关文档
-
-[各个部分单元测试说明](http://www.kancloud.cn/brother_simon/tp5_test/96971 "各部分单元测试说明")
-
-## 大家一起来
-
-单元测试的内容会跟框架同步,测试内容方方面面,是一个相对复杂的模块,同时也是一个值得重视的部分。希望大家能够多多提出意见,多多参与。如果你有任何问题或想法,可以随时提 issue,我们期待着收到听大家的质疑和讨论。
-
-## 任务进度
-
-单元测试任务进度,请大家认领模块
-
-|模块|认领人|进度|
-|---|---|---|
-|Base|||
-|App|Haotong Lin|√|
-|Build|刘志淳||
-|Config|Haotong Lin|√|
-|Cache|||
-|Controller|Haotong Lin|√|
-|Cookie|Haotong Lin|√|
-|Db|||
-|Debug|大漠|√|
-|Error|大漠||
-|Exception|Haotong Lin|√|
-|Hook|流年|√|
-|Input|Haotong Lin|√|
-|Lang|流年|√|
-|Loader|流年||
-|Log|||
-|Model|||
-|Response|大漠|√|
-|Route|流年||
-|Session|大漠|√|
-|Template|oldrind||
-|Url|流年||
-|View|mahuan||

+ 0 - 33
thinkphp/tests/application/config.php

@@ -1,33 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-// $Id$
-
-return [
-    'url_route_on' => true,
-    'log'          => [
-        'type' => 'file', // 支持 socket trace file
-    ],
-    'view'         => [
-        // 模板引擎
-        'engine_type'   => 'think',
-        // 模板引擎配置
-        'engine_config' => [
-            // 模板路径
-            'view_path'   => '',
-            // 模板后缀
-            'view_suffix' => '.html',
-            // 模板文件名分隔符
-            'view_depr'   => DS,
-        ],
-        // 输出字符串替换
-        'parse_str'     => [],
-    ],
-];

+ 0 - 44
thinkphp/tests/application/database.php

@@ -1,44 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-// $Id$
-
-return [
-    // 数据库类型
-    'type'        => 'mysql',
-    // 数据库连接DSN配置
-    'dsn'         => '',
-    // 服务器地址
-    'hostname'    => '127.0.0.1',
-    // 数据库名
-    'database'    => '',
-    // 数据库用户名
-    'username'    => 'root',
-    // 数据库密码
-    'password'    => '',
-    // 数据库连接端口
-    'hostport'    => '',
-    // 数据库连接参数
-    'params'      => [],
-    // 数据库编码默认采用utf8
-    'charset'     => 'utf8',
-    // 数据库表前缀
-    'prefix'      => '',
-    // 数据库调试模式
-    'debug'       => true,
-    // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
-    'deploy'      => 0,
-    // 数据库读写是否分离 主从式有效
-    'rw_separate' => false,
-    // 读写分离后 主服务器数量
-    'master_num'  => 1,
-    // 指定从服务器序号
-    'slave_no'    => '',
-];

Файловите разлики са ограничени, защото са твърде много
+ 0 - 10
thinkphp/tests/application/index/controller/Index.php


+ 0 - 22
thinkphp/tests/application/route.php

@@ -1,22 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-// $Id$
-
-return [
-    '__pattern__' => [
-        'name' => '\w+',
-    ],
-    '[hello]'     => [
-        ':id'   => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
-        ':name' => ['index/hello', ['method' => 'post']],
-    ],
-
-];

+ 0 - 1
thinkphp/tests/application/views/display.html

@@ -1 +0,0 @@
-{$name??'default'}

+ 0 - 1
thinkphp/tests/application/views/display.phtml

@@ -1 +0,0 @@
-{$name??'default'}

+ 0 - 2
thinkphp/tests/application/views/extend.html

@@ -1,2 +0,0 @@
-{extend name="extend2" /}
-{block name="head"}header{/block}

+ 0 - 17
thinkphp/tests/application/views/extend2.html

@@ -1,17 +0,0 @@
-{layout name="layout2" replace="[__REPLACE__]" /}
-{block name="head"}{/block}
-<div id="wrap">
-    {include file="include" name="info" value="$info.value" /}
-{block name="main"}
-{block name="side"}
-    side
-{/block}
-{block name="mainbody"}
-
-{/block}
-{/block}
-{literal}
-    {$name}
-{/literal}
-    <?php echo 'php code'; ?>
-</div>

+ 0 - 2
thinkphp/tests/application/views/include.html

@@ -1,2 +0,0 @@
-<input name="[name]" value="[value]">
-{include file="include2" /}

+ 0 - 1
thinkphp/tests/application/views/include2.html

@@ -1 +0,0 @@
-{$info.value}:

+ 0 - 2
thinkphp/tests/application/views/layout.html

@@ -1,2 +0,0 @@
-<div>{__CONTENT__}
-</div>

+ 0 - 2
thinkphp/tests/application/views/layout2.html

@@ -1,2 +0,0 @@
-<nav>[__REPLACE__]
-</nav>

+ 0 - 1
thinkphp/tests/conf/memcached.ini

@@ -1 +0,0 @@
-extension=memcached.so

+ 0 - 1
thinkphp/tests/conf/redis.ini

@@ -1 +0,0 @@
-extension=redis.so

+ 0 - 1
thinkphp/tests/conf/timezone.ini

@@ -1 +0,0 @@
-date.timezone = UTC

+ 0 - 13
thinkphp/tests/script/install.sh

@@ -1,13 +0,0 @@
-#!/bin/bash
-
-if [ $(phpenv version-name) != "hhvm" ]; then
-    cp tests/extensions/$(phpenv version-name)/*.so $(php-config --extension-dir)
-
-    phpenv config-add tests/conf/memcached.ini
-    phpenv config-add tests/conf/redis.ini
-
-    phpenv config-add tests/conf/timezone.ini
-fi
-
-composer install --no-interaction --ignore-platform-reqs
-composer update

+ 0 - 39
thinkphp/tests/thinkphp/baseTest.php

@@ -1,39 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: Haotong Lin <lofanmi@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * 保证运行环境正常
- */
-class baseTest extends \PHPUnit_Framework_TestCase
-{
-    public function testConstants()
-    {
-        $this->assertNotEmpty(THINK_START_TIME);
-        $this->assertNotEmpty(THINK_START_MEM);
-        $this->assertNotEmpty(THINK_VERSION);
-        $this->assertNotEmpty(DS);
-        $this->assertNotEmpty(THINK_PATH);
-        $this->assertNotEmpty(LIB_PATH);
-        $this->assertNotEmpty(EXTEND_PATH);
-        $this->assertNotEmpty(CORE_PATH);
-        $this->assertNotEmpty(TRAIT_PATH);
-        $this->assertNotEmpty(APP_PATH);
-        $this->assertNotEmpty(RUNTIME_PATH);
-        $this->assertNotEmpty(LOG_PATH);
-        $this->assertNotEmpty(CACHE_PATH);
-        $this->assertNotEmpty(TEMP_PATH);
-        $this->assertNotEmpty(VENDOR_PATH);
-        $this->assertNotEmpty(EXT);
-        $this->assertNotEmpty(ENV_PREFIX);
-        $this->assertTrue(!is_null(IS_WIN));
-        $this->assertTrue(!is_null(IS_CLI));
-    }
-}

Файловите разлики са ограничени, защото са твърде много
+ 0 - 90
thinkphp/tests/thinkphp/library/think/appTest.php


+ 0 - 15
thinkphp/tests/thinkphp/library/think/behavior/One.php

@@ -1,15 +0,0 @@
-<?php
-namespace tests\thinkphp\library\think\behavior;
-
-class One
-{
-    public function run(&$data) {
-        $data['id'] = 1;
-        return true;
-    }
-
-    public function test(&$data) {
-        $data['name'] = 'test';
-        return false;
-    }
-}

+ 0 - 9
thinkphp/tests/thinkphp/library/think/behavior/Three.php

@@ -1,9 +0,0 @@
-<?php
-namespace tests\thinkphp\library\think\behavior;
-
-class Three
-{
-    public function run(&$data) {
-        $data['id'] = 3;
-    }
-}

+ 0 - 9
thinkphp/tests/thinkphp/library/think/behavior/Two.php

@@ -1,9 +0,0 @@
-<?php
-namespace tests\thinkphp\library\think\behavior;
-
-class Two
-{
-    public function run(&$data) {
-        $data['id'] = 2;
-    }
-}

+ 0 - 73
thinkphp/tests/thinkphp/library/think/buildTest.php

@@ -1,73 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * build测试
- * @author    刘志淳 <chun@engineer.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Build;
-
-class buildTest extends \PHPUnit_Framework_TestCase
-{
-    public function testRun()
-    {
-        $build = [
-            // Test run directory
-            '__dir__'  => ['runtime/cache', 'runtime/log', 'runtime/temp', 'runtime/template'],
-            '__file__' => ['common.php'],
-
-            // Test generation module
-            'demo'     => [
-                '__file__'   => ['common.php'],
-                '__dir__'    => ['behavior', 'controller', 'model', 'view', 'service'],
-                'controller' => ['Index', 'Test', 'UserType'],
-                'model'      => ['User', 'UserType'],
-                'service'    => ['User', 'UserType'],
-                'view'       => ['index/index'],
-            ],
-        ];
-        Build::run($build);
-
-        $this->buildFileExists($build);
-    }
-
-    protected function buildFileExists($build)
-    {
-        foreach ($build as $module => $list) {
-            if ('__dir__' == $module || '__file__' == $module) {
-                foreach ($list as $file) {
-                    $this->assertFileExists(APP_PATH . $file);
-                }
-            } else {
-                foreach ($list as $path => $moduleList) {
-                    if ('__file__' == $path || '__dir__' == $path) {
-                        foreach ($moduleList as $file) {
-                            $this->assertFileExists(APP_PATH . $module . '/' . $file);
-                        }
-                    } else {
-                        foreach ($moduleList as $file) {
-                            if ('view' == $path) {
-                                $file_name = APP_PATH . $module . '/' . $path . '/' . $file . '.html';
-                            } else {
-                                $file_name = APP_PATH . $module . '/' . $path . '/' . $file . EXT;
-                            }
-                            $this->assertFileExists($file_name);
-                        }
-                    }
-                }
-                $this->assertFileExists(APP_PATH . ($module ? $module . DS : '') . 'config.php');
-            }
-        }
-    }
-}

+ 0 - 207
thinkphp/tests/thinkphp/library/think/cache/driver/cacheTestCase.php

@@ -1,207 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * 缓存抽象类,提供一些测试
- * @author simon <mahuan@d1web.top>
- */
-
-namespace tests\thinkphp\library\think\cache\driver;
-
-use think\Cache;
-
-abstract class cacheTestCase extends \PHPUnit_Framework_TestCase
-{
-
-    /**
-     * 获取缓存句柄,子类必须有
-     * @access protected
-     */
-    abstract protected function getCacheInstance();
-
-    /**
-     * tearDown函数
-     */
-    protected function tearDown()
-    {
-    }
-
-    /**
-     * 设定一组测试值,包括测试字符串、整数、数组和对象
-     * @return  mixed
-     * @access public
-     */
-    public function prepare()
-    {
-        $cache = $this->getCacheInstance();
-        $cache->clear();
-        $cache->set('string_test', 'string_test');
-        $cache->set('number_test', 11);
-        $cache->set('array_test', ['array_test' => 'array_test']);
-        return $cache;
-    }
-
-    /**
-     * 测试缓存设置,包括测试字符串、整数、数组和对象
-     * @return  mixed
-     * @access public
-     */
-    public function testSet()
-    {
-        $cache = $this->getCacheInstance();
-        $this->assertTrue($cache->set('string_test', 'string_test'));
-        $this->assertTrue($cache->set('number_test', 11));
-        $this->assertTrue($cache->set('array_test', ['array_test' => 'array_test']));
-    }
-
-    /**
-     * 测试缓存自增
-     * @return  mixed
-     * @access public
-     */
-    public function testInc()
-    {
-        $cache = $this->getCacheInstance();
-        $this->assertEquals(14, $cache->inc('number_test', 3));
-    }
-
-    /**
-     * 测试缓存自减
-     * @return  mixed
-     * @access public
-     */
-    public function testDec()
-    {
-        $cache = $this->getCacheInstance();
-        $this->assertEquals(8, $cache->dec('number_test', 6));
-    }
-
-    /**
-     * 测试缓存读取,包括测试字符串、整数、数组和对象
-     * @return  mixed
-     * @access public
-     */
-    public function testGet()
-    {
-        $cache = $this->prepare();
-        $this->assertEquals('string_test', $cache->get('string_test'));
-        $this->assertEquals(11, $cache->get('number_test'));
-        $array = $cache->get('array_test');
-        $this->assertArrayHasKey('array_test', $array);
-        $this->assertEquals('array_test', $array['array_test']);
-
-        $result = $cache->set('no_expire', 1, 0);
-        $this->assertTrue($result);
-    }
-
-    /**
-     * 测试缓存存在情况,包括测试字符串、整数、数组和对象
-     * @return  mixed
-     * @access public
-     */
-    public function testExists()
-    {
-        $cache = $this->prepare();
-        $this->assertNotEmpty($cache->has('string_test'));
-        $this->assertNotEmpty($cache->has('number_test'));
-        $this->assertFalse($cache->has('not_exists'));
-    }
-
-    /**
-     * 测试缓存不存在情况,包括测试字符串、整数、数组和对象
-     * @return  mixed
-     * @access public
-     */
-    public function testGetNonExistent()
-    {
-        $cache = $this->getCacheInstance();
-        $this->assertFalse($cache->get('non_existent_key', false));
-    }
-
-    /**
-     * 测试特殊值缓存,包括测试字符串、整数、数组和对象
-     * @return  mixed
-     * @access public
-     */
-    public function testStoreSpecialValues()
-    {
-        $cache = $this->getCacheInstance();
-        $cache->set('null_value', null);
-        //清空缓存后,返回null而不是false
-        $this->assertTrue(is_null($cache->get('null_value')));
-    }
-
-    /**
-     * 缓存过期测试
-     * @return  mixed
-     * @access public
-     */
-    public function testExpire()
-    {
-        $cache = $this->getCacheInstance();
-        $this->assertTrue($cache->set('expire_test', 'expire_test', 1));
-        usleep(600000);
-        $this->assertEquals('expire_test', $cache->get('expire_test'));
-        usleep(800000);
-        $this->assertFalse($cache->get('expire_test'));
-    }
-
-    /**
-     * 删除缓存测试
-     * @return  mixed
-     * @access public
-     */
-    public function testDelete()
-    {
-        $cache = $this->prepare();
-        $this->assertNotNull($cache->rm('number_test'));
-        $this->assertFalse($cache->get('number_test'));
-    }
-
-    /**
-     * 获取并删除缓存测试
-     * @return  mixed
-     * @access public
-     */
-    public function testPull()
-    {
-        $cache = $this->prepare();
-        $this->assertEquals(11, $cache->pull('number_test'));
-        $this->assertFalse($cache->get('number_test'));
-    }
-
-    /**
-     * 清空缓存测试
-     * @return  mixed
-     * @access public
-     */
-    public function testClear()
-    {
-        $cache = $this->prepare();
-        $this->assertTrue($cache->clear());
-        $this->assertFalse($cache->get('number_test'));
-    }
-
-    public function testStaticCall()
-    {
-        $this->assertTrue(Cache::set('a', 1));
-        $this->assertEquals(1, Cache::get('a'));
-        $this->assertEquals(2, Cache::inc('a'));
-        $this->assertEquals(4, Cache::inc('a', 2));
-        $this->assertEquals(4, Cache::get('a'));
-        $this->assertEquals(3, Cache::dec('a'));
-        $this->assertEquals(1, Cache::dec('a', 2));
-        $this->assertEquals(1, Cache::get('a'));
-        $this->assertNotNull(Cache::rm('a'));
-        $this->assertNotNull(Cache::clear());
-    }
-
-}

+ 0 - 46
thinkphp/tests/thinkphp/library/think/cache/driver/fileTest.php

@@ -1,46 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * File缓存驱动测试
- * @author    刘志淳 <chun@engineer.com>
- */
-
-namespace tests\thinkphp\library\think\cache\driver;
-
-class fileTest extends cacheTestCase
-{
-    private $_cacheInstance = null;
-
-    /**
-     * 基境缓存类型
-     */
-    protected function setUp()
-    {
-        \think\Cache::connect(['type' => 'File', 'path' => CACHE_PATH]);
-    }
-
-    /**
-     * @return FileCache
-     */
-    protected function getCacheInstance()
-    {
-        if (null === $this->_cacheInstance) {
-            $this->_cacheInstance = new \think\cache\driver\File();
-        }
-        return $this->_cacheInstance;
-    }
-
-    // skip testExpire
-    public function testExpire()
-    {
-    }
-}

+ 0 - 69
thinkphp/tests/thinkphp/library/think/cache/driver/liteTest.php

@@ -1,69 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Lite缓存驱动测试
- * @author    刘志淳 <chun@engineer.com>
- */
-
-namespace tests\thinkphp\library\think\cache\driver;
-
-use think\Cache;
-
-class liteTest extends \PHPUnit_Framework_TestCase
-{
-    protected function getCacheInstance()
-    {
-        return Cache::connect(['type' => 'Lite', 'path' => CACHE_PATH]);
-    }
-
-    /**
-     * 测试缓存读取
-     * @return  mixed
-     * @access public
-     */
-    public function testGet()
-    {
-        $cache = $this->getCacheInstance();
-        $this->assertFalse($cache->get('test'));
-    }
-
-    /**
-     * 测试缓存设置
-     * @return  mixed
-     * @access public
-     */
-    public function testSet()
-    {
-        $cache = $this->getCacheInstance();
-        $this->assertNotEmpty($cache->set('test', 'test'));
-    }
-
-    /**
-     * 删除缓存测试
-     * @return  mixed
-     * @access public
-     */
-    public function testRm()
-    {
-        $cache = $this->getCacheInstance();
-        $this->assertTrue($cache->rm('test'));
-    }
-
-    /**
-     * 清空缓存测试
-     * @return  mixed
-     * @access public
-     */
-    public function testClear()
-    {
-    }
-}

+ 0 - 49
thinkphp/tests/thinkphp/library/think/cache/driver/memcacheTest.php

@@ -1,49 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Memcache缓存驱动测试
- * @author    刘志淳 <chun@engineer.com>
- */
-
-namespace tests\thinkphp\library\think\cache\driver;
-
-class memcacheTest extends cacheTestCase
-{
-    private $_cacheInstance = null;
-
-    /**
-     * 基境缓存类型
-     */
-    protected function setUp()
-    {
-        if (!extension_loaded('memcache')) {
-            $this->markTestSkipped("Memcache没有安装,已跳过测试!");
-        }
-        \think\Cache::connect(['type' => 'memcache', 'expire' => 2]);
-    }
-
-    /**
-     * @return ApcCache
-     */
-    protected function getCacheInstance()
-    {
-        if (null === $this->_cacheInstance) {
-            $this->_cacheInstance = new \think\cache\driver\Memcache(['length' => 3]);
-        }
-        return $this->_cacheInstance;
-    }
-
-    // skip testExpire
-    public function testExpire()
-    {
-    }
-}

+ 0 - 72
thinkphp/tests/thinkphp/library/think/cache/driver/memcachedTest.php

@@ -1,72 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Memcached缓存驱动测试
- * @author    7IN0SAN9 <me@7in0.me>
- */
-
-namespace tests\thinkphp\library\think\cache\driver;
-
-class memcachedTest extends cacheTestCase
-{
-    private $_cacheInstance = null;
-    /**
-     * 基境缓存类型
-     */
-    protected function setUp()
-    {
-        if (!extension_loaded("memcached") && !extension_loaded('memcache')) {
-            $this->markTestSkipped("Memcached或Memcache没有安装,已跳过测试!");
-        }
-        \think\Cache::connect(array('type' => 'memcached', 'expire' => 2));
-    }
-    /**
-     * @return ApcCache
-     */
-    protected function getCacheInstance()
-    {
-        if (null === $this->_cacheInstance) {
-            $this->_cacheInstance = new \think\cache\driver\Memcached(['length' => 3]);
-        }
-        return $this->_cacheInstance;
-    }
-    /**
-     * 缓存过期测试《提出来测试,因为目前看通不过缓存过期测试,所以还需研究》
-     * @return  mixed
-     * @access public
-     */
-    public function testExpire()
-    {
-    }
-
-    public function testStaticCall()
-    {
-    }
-
-    /**
-     * 测试缓存自增
-     * @return  mixed
-     * @access public
-     */
-    public function testInc()
-    {
-    }
-
-    /**
-     * 测试缓存自减
-     * @return  mixed
-     * @access public
-     */
-    public function testDec()
-    {
-    }
-}

+ 0 - 66
thinkphp/tests/thinkphp/library/think/cache/driver/redisTest.php

@@ -1,66 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Redis缓存驱动测试
- * @author    7IN0SAN9 <me@7in0.me>
- */
-
-namespace tests\thinkphp\library\think\cache\driver;
-
-class redisTest extends cacheTestCase
-{
-    private $_cacheInstance = null;
-
-    protected function setUp()
-    {
-        if (!extension_loaded("redis")) {
-            $this->markTestSkipped("Redis没有安装,已跳过测试!");
-        }
-        \think\Cache::connect(array('type' => 'redis', 'expire' => 2));
-    }
-
-    protected function getCacheInstance()
-    {
-        if (null === $this->_cacheInstance) {
-            $this->_cacheInstance = new \think\cache\driver\Redis(['length' => 3]);
-        }
-        return $this->_cacheInstance;
-    }
-
-    public function testGet()
-    {
-        $cache = $this->prepare();
-        $this->assertEquals('string_test', $cache->get('string_test'));
-        $this->assertEquals(11, $cache->get('number_test'));
-        $result = $cache->get('array_test');
-        $this->assertEquals('array_test', $result['array_test']);
-    }
-
-    public function testStoreSpecialValues()
-    {
-        $redis = new \think\cache\driver\Redis(['length' => 3]);
-        $redis->set('key', 'value');
-        $redis->get('key');
-
-        $redis->handler()->setnx('key', 'value');
-        $value = $redis->handler()->get('key');
-        $this->assertEquals('value', $value);
-
-        $redis->handler()->hset('hash', 'key', 'value');
-        $value = $redis->handler()->hget('hash', 'key');
-        $this->assertEquals('value', $value);
-    }
-
-    public function testExpire()
-    {
-    }
-}

+ 0 - 315
thinkphp/tests/thinkphp/library/think/cacheTest.php

@@ -1,315 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-namespace tests\thinkphp\library\think;
-
-use tests\thinkphp\library\think\config\ConfigInitTrait;
-use think\Cache;
-use think\Config;
-
-class cacheTest extends \PHPUnit_Framework_TestCase
-{
-    use ConfigInitTrait {
-        ConfigInitTrait::tearDown as ConfigTearDown;
-    }
-
-    public function tearDown()
-    {
-        $this->ConfigTearDown();
-
-        call_user_func(\Closure::bind(function () {
-            Cache::$handler    = null;
-            Cache::$instance   = [];
-            Cache::$readTimes  = 0;
-            Cache::$writeTimes = 0;
-        }, null, '\think\Cache'));
-    }
-
-    /**
-     * @dataProvider provideTestConnect
-     */
-    public function testConnect($options, $expected)
-    {
-        $connection = Cache::connect($options);
-        $this->assertInstanceOf($expected, $connection);
-        $this->assertSame($connection, Cache::connect($options));
-
-        $instance = $this->getPropertyVal('instance');
-        $this->assertArrayHasKey(md5(serialize($options)), $instance);
-
-        $newConnection = Cache::connect($options, true);
-        $newInstance = $this->getPropertyVal('instance');
-        $this->assertInstanceOf($expected, $connection);
-        $this->assertNotSame($connection, $newConnection);
-        $this->assertEquals($instance, $newInstance);
-    }
-
-    /**
-     * @dataProvider provideTestInit
-     */
-    public function testInit($options, $expected)
-    {
-        $connection = Cache::init($options);
-        $this->assertInstanceOf($expected, $connection);
-
-        $connectionNew = Cache::init(['type' => 'foo']);
-        $this->assertSame($connection, $connectionNew);
-    }
-
-    public function testStore()
-    {
-        Config::set('cache.redis', ['type' => 'redis']);
-
-        $connectionDefault = Cache::store();
-        $this->assertInstanceOf('\think\cache\driver\File', $connectionDefault);
-
-        Config::set('cache.type', false);
-        $connectionNotRedis = Cache::store('redis');
-        $this->assertSame($connectionDefault, $connectionNotRedis);
-
-        Config::set('cache.type', 'complex');
-        $connectionRedis = Cache::store('redis');
-        $this->assertNotSame($connectionNotRedis, $connectionRedis);
-        $this->assertInstanceOf('\think\cache\driver\Redis', $connectionRedis);
-
-        // 即便成功切换到其他存储类型,也不影响原先的操作句柄
-        $this->assertSame($connectionDefault, Cache::store());
-    }
-
-    public function testHas()
-    {
-        $key = $this->buildTestKey('Has');
-
-        $this->assertFalse(Cache::has($key));
-
-        Cache::set($key, 5);
-        $this->assertTrue(Cache::has($key));
-    }
-
-    public function testGet()
-    {
-        $key = $this->buildTestKey('Get');
-
-        $this->assertFalse(Cache::get($key));
-
-        $this->assertEquals('default', Cache::get($key, 'default'));
-
-        Cache::set($key, 5);
-        $this->assertSame(5, Cache::get($key));
-    }
-
-    public function testSet()
-    {
-        $key = $this->buildTestKey('Set');
-
-        $this->assertTrue(Cache::set(null, null));
-        $this->assertTrue(Cache::set($key, 'ThinkPHP3.2'));
-        $this->assertTrue(Cache::set($key, 'ThinkPHP5.0', null));
-        $this->assertTrue(Cache::set($key, 'ThinkPHP5.0', -1));
-        $this->assertTrue(Cache::set($key, 'ThinkPHP5.0', 0));
-        $this->assertTrue(Cache::set($key, 'ThinkPHP5.0', 7200));
-    }
-
-    public function testInc()
-    {
-        $key = $this->buildTestKey('Inc');
-
-        Cache::inc($key);
-        $this->assertEquals(1, Cache::get($key));
-
-        Cache::inc($key, '2');
-        $this->assertEquals(3, Cache::get($key));
-
-        Cache::inc($key, -1);
-        $this->assertEquals(2, Cache::get($key));
-
-        Cache::inc($key, null);
-        $this->assertEquals(2, Cache::get($key));
-
-        Cache::inc($key, true);
-        $this->assertEquals(3, Cache::get($key));
-
-        Cache::inc($key, false);
-        $this->assertEquals(3, Cache::get($key));
-
-        Cache::inc($key, 0.789);
-        $this->assertEquals(3.789, Cache::get($key));
-    }
-    public function testDec()
-    {
-        $key = $this->buildTestKey('Dec');
-
-        Cache::dec($key);
-        $this->assertEquals(-1, Cache::get($key));
-
-        Cache::dec($key, '2');
-        $this->assertEquals(-3, Cache::get($key));
-
-        Cache::dec($key, -1);
-        $this->assertEquals(-2, Cache::get($key));
-
-        Cache::dec($key, null);
-        $this->assertEquals(-2, Cache::get($key));
-
-        Cache::dec($key, true);
-        $this->assertEquals(-3, Cache::get($key));
-
-        Cache::dec($key, false);
-        $this->assertEquals(-3, Cache::get($key));
-
-        Cache::dec($key, 0.359);
-        $this->assertEquals(-3.359, Cache::get($key));
-    }
-
-    public function testRm()
-    {
-        $key = $this->buildTestKey('Rm');
-
-        $this->assertFalse(Cache::rm($key));
-
-        Cache::set($key, 'ThinkPHP');
-        $this->assertTrue(Cache::rm($key));
-    }
-
-    public function testClear()
-    {
-        $key1 = $this->buildTestKey('Clear1');
-        $key2 = $this->buildTestKey('Clear2');
-
-        Cache::set($key1, 'ThinkPHP3.2');
-        Cache::set($key2, 'ThinkPHP5.0');
-
-        $this->assertEquals('ThinkPHP3.2', Cache::get($key1));
-        $this->assertEquals('ThinkPHP5.0', Cache::get($key2));
-        Cache::clear();
-        $this->assertFalse(Cache::get($key1));
-        $this->assertFalse(Cache::get($key2));
-    }
-
-    public function testPull()
-    {
-        $key = $this->buildTestKey('Pull');
-
-        $this->assertNull(Cache::pull($key));
-
-        Cache::set($key, 'ThinkPHP');
-        $this->assertEquals('ThinkPHP', Cache::pull($key));
-        $this->assertFalse(Cache::get($key));
-    }
-
-    public function testRemember()
-    {
-        $key1 = $this->buildTestKey('Remember1');
-        $key2 = $this->buildTestKey('Remember2');
-
-        $this->assertEquals('ThinkPHP3.2', Cache::remember($key1, 'ThinkPHP3.2'));
-        $this->assertEquals('ThinkPHP3.2', Cache::remember($key1, 'ThinkPHP5.0'));
-
-        $this->assertEquals('ThinkPHP5.0', Cache::remember($key2, function () {
-            return 'ThinkPHP5.0';
-        }));
-        $this->assertEquals('ThinkPHP5.0', Cache::remember($key2, function () {
-            return 'ThinkPHP3.2';
-        }));
-    }
-
-    public function testTag()
-    {
-        $key = $this->buildTestKey('Tag');
-
-        $cacheTagWithoutName = Cache::tag(null);
-        $this->assertInstanceOf('think\cache\Driver', $cacheTagWithoutName);
-
-        $cacheTagWithKey = Cache::tag($key, [1, 2, 3]);
-        $this->assertSame($cacheTagWithoutName, $cacheTagWithKey);
-    }
-
-    protected function getPropertyVal($name)
-    {
-        static $reflectionClass;
-        if (empty($reflectionClass)) {
-            $reflectionClass = new \ReflectionClass('\think\Cache');
-        }
-
-        $property = $reflectionClass->getProperty($name);
-        $property->setAccessible(true);
-
-        return $property->getValue();
-    }
-
-    public function provideTestConnect()
-    {
-        $provideData = [];
-
-        $options   = ['type' => null];
-        $expected  = '\think\cache\driver\File';
-        $provideData[] = [$options, $expected];
-
-        $options   = ['type' => 'File'];
-        $expected  = '\think\cache\driver\File';
-        $provideData[] = [$options, $expected];
-
-        $options   = ['type' => 'Lite'];
-        $expected  = '\think\cache\driver\Lite';
-        $provideData[] = [$options, $expected];
-
-        $options   = ['type' => 'Memcached'];
-        $expected  = '\think\cache\driver\Memcached';
-        $provideData[] = [$options, $expected];
-
-        $options   = ['type' => 'Redis'];
-        $expected  = '\think\cache\driver\Redis';
-        $provideData[] = [$options, $expected];
-
-        // TODO
-        // $options   = ['type' => 'Memcache'];
-        // $expected  = '\think\cache\driver\Memcache';
-        // $provideData[] = [$options, $expected];
-        //
-        // $options   = ['type' => 'Wincache'];
-        // $expected  = '\think\cache\driver\Wincache';
-        // $provideData[] = [$options, $expected];
-
-        // $options   = ['type' => 'Sqlite'];
-        // $expected  = '\think\cache\driver\Sqlite';
-        // $provideData[] = [$options, $expected];
-        //
-        // $options   = ['type' => 'Xcache'];
-        // $expected  = '\think\cache\driver\Xcache';
-        // $provideData[] = [$options, $expected];
-
-        return $provideData;
-    }
-
-    public function provideTestInit()
-    {
-        $provideData = [];
-
-        $options   = [];
-        $expected  = '\think\cache\driver\File';
-        $provideData[] = [$options, $expected];
-
-        $options   = ['type' => 'File'];
-        $expected  = '\think\cache\driver\File';
-        $provideData[] = [$options, $expected];
-
-        $options   = ['type' => 'Lite'];
-        $expected  = '\think\cache\driver\Lite';
-        $provideData[] = [$options, $expected];
-
-        return $provideData;
-    }
-
-    protected function buildTestKey($tag)
-    {
-        return sprintf('ThinkPHP_Test_%s_%d_%d', $tag, time(), rand(0, 10000));
-    }
-}

+ 0 - 52
thinkphp/tests/thinkphp/library/think/config/ConfigInitTrait.php

@@ -1,52 +0,0 @@
-<?php
-
-/**
- * 测试用例在使用Config时(如reset),可能会影响其他测试用例
- * 此Trait在每次执行测试用例后会对Config进行还原
- */
-namespace tests\thinkphp\library\think\config;
-
-use think\Config;
-
-trait ConfigInitTrait
-{
-    /**
-     * @var \Closure
-     */
-    protected static $internalConfigFoo;
-
-    /**
-     * @var \Closure
-     */
-    protected static $internalRangeFoo;
-
-    /**
-     * @var mixed
-     */
-    protected static $originConfig;
-
-    /**
-     * @var string
-     */
-    protected static $originRange;
-
-    public static function setUpBeforeClass()
-    {
-        self::$internalConfigFoo = \Closure::bind(function ($value = null) {
-            return !is_null($value) ? Config::$config = $value : Config::$config;
-        }, null, '\\Think\\Config');
-
-        self::$internalRangeFoo  = \Closure::bind(function ($value = null) {
-            return !is_null($value) ? Config::$range = $value : Config::$range;
-        }, null, '\\Think\\Config');
-
-        self::$originConfig = call_user_func(self::$internalConfigFoo);
-        self::$originRange  = call_user_func(self::$internalRangeFoo);
-    }
-
-    public function tearDown()
-    {
-        call_user_func(self::$internalConfigFoo, self::$originConfig);
-        call_user_func(self::$internalRangeFoo, self::$originRange);
-    }
-}

+ 0 - 1
thinkphp/tests/thinkphp/library/think/config/driver/fixtures/config.ini

@@ -1 +0,0 @@
-inifile=1

+ 0 - 1
thinkphp/tests/thinkphp/library/think/config/driver/fixtures/config.json

@@ -1 +0,0 @@
-{"jsonstring":1}

+ 0 - 6
thinkphp/tests/thinkphp/library/think/config/driver/fixtures/config.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<document>
-    <xmlfile>
-        <istrue>1</istrue>
-    </xmlfile>
-</document>

+ 0 - 36
thinkphp/tests/thinkphp/library/think/config/driver/iniTest.php

@@ -1,36 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Ini配置测试
- * @author    7IN0SAN9 <me@7in0.me>
- */
-
-namespace tests\thinkphp\library\think\config\driver;
-
-use tests\thinkphp\library\think\config\ConfigInitTrait;
-use think\config;
-
-class iniTest extends \PHPUnit_Framework_TestCase
-{
-    use ConfigInitTrait;
-
-    public function testParse()
-    {
-        Config::parse('inistring=1', 'ini');
-        $this->assertEquals(1, Config::get('inistring'));
-        Config::reset();
-        Config::parse(__DIR__ . '/fixtures/config.ini');
-        $this->assertTrue(Config::has('inifile'));
-        $this->assertEquals(1, Config::get('inifile'));
-        Config::reset();
-    }
-}

+ 0 - 36
thinkphp/tests/thinkphp/library/think/config/driver/jsonTest.php

@@ -1,36 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Xml配置测试
- * @author    7IN0SAN9 <me@7in0.me>
- */
-
-namespace tests\thinkphp\library\think\config\driver;
-
-use tests\thinkphp\library\think\config\ConfigInitTrait;
-use think\config;
-
-class jsonTest extends \PHPUnit_Framework_TestCase
-{
-    use ConfigInitTrait;
-
-    public function testParse()
-    {
-        Config::parse('{"jsonstring":1}', 'json');
-        $this->assertEquals(1, Config::get('jsonstring'));
-        Config::reset();
-        Config::parse(__DIR__ . '/fixtures/config.json');
-        $this->assertTrue(Config::has('jsonstring'));
-        $this->assertEquals(1, Config::get('jsonstring'));
-        Config::reset();
-    }
-}

+ 0 - 36
thinkphp/tests/thinkphp/library/think/config/driver/xmlTest.php

@@ -1,36 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Xml配置测试
- * @author    7IN0SAN9 <me@7in0.me>
- */
-
-namespace tests\thinkphp\library\think\config\driver;
-
-use tests\thinkphp\library\think\config\ConfigInitTrait;
-use think\config;
-
-class xmlTest extends \PHPUnit_Framework_TestCase
-{
-    use ConfigInitTrait;
-
-    public function testParse()
-    {
-        Config::parse('<?xml version="1.0"?><document><xmlstring>1</xmlstring></document>', 'xml');
-        $this->assertEquals(1, Config::get('xmlstring'));
-        Config::reset();
-        Config::parse(__DIR__ . '/fixtures/config.xml');
-        $this->assertTrue(Config::has('xmlfile.istrue'));
-        $this->assertEquals(1, Config::get('xmlfile.istrue'));
-        Config::reset();
-    }
-}

+ 0 - 149
thinkphp/tests/thinkphp/library/think/configTest.php

@@ -1,149 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * 配置测试
- * @author    Haotong Lin <lofanmi@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use tests\thinkphp\library\think\config\ConfigInitTrait;
-use think\Config;
-
-class configTest extends \PHPUnit_Framework_TestCase
-{
-    use ConfigInitTrait;
-
-    public function testRange()
-    {
-        // test default range
-        $this->assertEquals('_sys_', call_user_func(self::$internalRangeFoo));
-
-        $this->assertTrue(is_array(call_user_func(self::$internalConfigFoo)));
-        // test range initialization
-        Config::range('_test_');
-        $this->assertEquals('_test_', call_user_func(self::$internalRangeFoo));
-        $this->assertEquals([], call_user_func(self::$internalConfigFoo)['_test_']);
-    }
-
-    // public function testParse()
-    // {
-    //  see \think\config\driver\...Test.php
-    // }
-
-    public function testLoad()
-    {
-        $file   = APP_PATH . 'config' . EXT;
-        $config = array_change_key_case(include $file);
-        $name   = '_name_';
-        $range  = '_test_';
-
-        $this->assertEquals($config, Config::load($file, $name, $range));
-        $this->assertNotEquals(null, Config::load($file, $name, $range));
-    }
-
-    public function testHas()
-    {
-        $range = '_test_';
-        $this->assertFalse(Config::has('abcd', $range));
-
-        call_user_func(self::$internalConfigFoo, [
-            $range => ['abcd' => 'value'],
-        ]);
-        $this->assertTrue(Config::has('abcd', $range));
-
-        // else ...
-        $this->assertFalse(Config::has('abcd.efg', $range));
-
-        call_user_func(self::$internalConfigFoo, [
-            $range => ['abcd' => ['efg' => 'value']],
-        ]);
-        $this->assertTrue(Config::has('abcd.efg', $range));
-    }
-
-    public function testGet()
-    {
-        $range = '_test_';
-        call_user_func(self::$internalConfigFoo, [
-            $range => []
-        ]);
-        $this->assertEquals([], Config::get(null, $range));
-        $this->assertEquals(null, Config::get(null, 'does_not_exist'));
-        $value = 'value';
-        // test getting configuration
-        call_user_func(self::$internalConfigFoo, [
-            $range => ['abcd' => 'efg']
-        ]);
-        $this->assertEquals('efg', Config::get('abcd', $range));
-        $this->assertEquals(null, Config::get('does_not_exist', $range));
-        $this->assertEquals(null, Config::get('abcd', 'does_not_exist'));
-        // test getting configuration with dot syntax
-        call_user_func(self::$internalConfigFoo, [
-            $range => ['one' => ['two' => $value]]
-        ]);
-        $this->assertEquals($value, Config::get('one.two', $range));
-        $this->assertEquals(null, Config::get('one.does_not_exist', $range));
-        $this->assertEquals(null, Config::get('one.two', 'does_not_exist'));
-    }
-
-    public function testSet()
-    {
-        $range = '_test_';
-
-        // without dot syntax
-        $name  = 'name';
-        $value = 'value';
-        Config::set($name, $value, $range);
-        $config = call_user_func(self::$internalConfigFoo);
-        $this->assertEquals($value, $config[$range][$name]);
-        // with dot syntax
-        $name  = 'one.two';
-        $value = 'dot value';
-        Config::set($name, $value, $range);
-        $config = call_user_func(self::$internalConfigFoo);
-        $this->assertEquals($value, $config[$range]['one']['two']);
-        // if (is_array($name)):
-        // see testLoad()
-        // ...
-        // test getting all configurations...?
-        // return self::$config[$range]; ??
-        $value = ['all' => 'configuration'];
-        call_user_func(self::$internalConfigFoo, [$range => $value]);
-        $this->assertEquals($value, Config::set(null, null, $range));
-        $this->assertNotEquals(null, Config::set(null, null, $range));
-    }
-
-    public function testReset()
-    {
-        $range = '_test_';
-        call_user_func(self::$internalConfigFoo, [$range => ['abcd' => 'efg']]);
-
-        // clear all configurations
-        Config::reset(true);
-        $config = call_user_func(self::$internalConfigFoo);
-        $this->assertEquals([], $config);
-        // clear the configuration in range of parameter.
-        call_user_func(self::$internalConfigFoo, [
-            $range => [
-                'abcd' => 'efg',
-                'hijk' => 'lmn',
-            ],
-            'a'    => 'b',
-        ]);
-        Config::reset($range);
-        $config = call_user_func(self::$internalConfigFoo);
-        $this->assertEquals([
-            $range => [],
-            'a'    => 'b',
-        ], $config);
-    }
-}

+ 0 - 2
thinkphp/tests/thinkphp/library/think/controller/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 0 - 194
thinkphp/tests/thinkphp/library/think/controllerTest.php

@@ -1,194 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * 控制器测试
- * @author    Haotong Lin <lofanmi@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use ReflectionClass;
-use think\Controller;
-use think\Request;
-use think\View;
-
-require_once CORE_PATH . '../../helper.php';
-
-class Foo extends Controller
-{
-    public $test = 'test';
-
-    public function _initialize()
-    {
-        $this->test = 'abcd';
-    }
-
-    public function assignTest()
-    {
-        $this->assign('abcd', 'dcba');
-        $this->assign(['key1' => 'value1', 'key2' => 'value2']);
-    }
-
-    public function fetchTest()
-    {
-        $template = APP_PATH . 'views' . DS .'display.html';
-        return $this->fetch($template, ['name' => 'ThinkPHP']);
-    }
-
-    public function displayTest()
-    {
-        $template = APP_PATH . 'views' . DS .'display.html';
-        return $this->display($template, ['name' => 'ThinkPHP']);
-    }
-    public function test()
-    {
-        $data       = [
-            'username'   => 'username',
-            'nickname'   => 'nickname',
-            'password'   => '123456',
-            'repassword' => '123456',
-            'email'      => 'abc@abc.com',
-            'sex'        => '0',
-            'age'        => '20',
-            'code'       => '1234',
-        ];
-
-        $validate = [
-            ['username', 'length:5,15', '用户名长度为5到15个字符'],
-            ['nickname', 'require', '请填昵称'],
-            ['password', '[\w-]{6,15}', '密码长度为6到15个字符'],
-            ['repassword', 'confirm:password', '两次密码不一到致'],
-            ['email', 'filter:validate_email', '邮箱格式错误'],
-            ['sex', 'in:0,1', '性别只能为为男或女'],
-            ['age', 'between:1,80', '年龄只能在10-80之间'],
-        ];
-        return $this->validate($data, $validate);
-    }
-}
-
-class Bar extends Controller
-{
-    public $test = 1;
-
-    public $beforeActionList = ['action1', 'action2'];
-
-    public function action1()
-    {
-        $this->test += 2;
-        return 'action1';
-    }
-
-    public function action2()
-    {
-        $this->test += 4;
-        return 'action2';
-    }
-}
-
-class Baz extends Controller
-{
-    public $test = 1;
-
-    public $beforeActionList = [
-        'action1' => ['only' => 'index'],
-        'action2' => ['except' => 'index'],
-        'action3' => ['only' => 'abcd'],
-        'action4' => ['except' => 'abcd'],
-    ];
-
-    public function action1()
-    {
-        $this->test += 2;
-        return 'action1';
-    }
-
-    public function action2()
-    {
-        $this->test += 4;
-        return 'action2';
-    }
-
-    public function action3()
-    {
-        $this->test += 8;
-        return 'action2';
-    }
-
-    public function action4()
-    {
-        $this->test += 16;
-        return 'action2';
-    }
-}
-
-class controllerTest extends \PHPUnit_Framework_TestCase
-{
-    public function testInitialize()
-    {
-        $foo = new Foo(Request::instance());
-        $this->assertEquals('abcd', $foo->test);
-    }
-
-    public function testBeforeAction()
-    {
-        $obj = new Bar(Request::instance());
-        $this->assertEquals(7, $obj->test);
-
-        $obj = new Baz(Request::instance());
-        $this->assertEquals(19, $obj->test);
-    }
-
-    private function getView($controller)
-    {
-        $view     = new View();
-        $rc       = new ReflectionClass(get_class($controller));
-        $property = $rc->getProperty('view');
-        $property->setAccessible(true);
-        $property->setValue($controller, $view);
-        return $view;
-    }
-
-    public function testFetch()
-    {
-        $controller      = new Foo(Request::instance());
-        $view            = $this->getView($controller);
-        $template        = APP_PATH . 'views' . DS .'display.html';
-        $viewFetch       = $view->fetch($template, ['name' => 'ThinkPHP']);
-        $this->assertEquals($controller->fetchTest(), $viewFetch);
-    }
-
-    public function testDisplay()
-    {
-        $controller      = new Foo;
-        $view            = $this->getView($controller);
-        $template        = APP_PATH . 'views' . DS .'display.html';
-        $viewFetch       = $view->display($template, ['name' => 'ThinkPHP']);
-
-        $this->assertEquals($controller->displayTest(), $viewFetch);
-    }
-
-    public function testAssign()
-    {
-        $controller = new Foo(Request::instance());
-        $view       = $this->getView($controller);
-        $controller->assignTest();
-        $expect = ['abcd' => 'dcba', 'key1' => 'value1', 'key2' => 'value2'];
-        $this->assertAttributeEquals($expect, 'data', $view);
-    }
-
-    public function testValidate()
-    {
-        $controller = new Foo(Request::instance());
-        $result = $controller->test();
-        $this->assertTrue($result);
-    }
-}

+ 0 - 150
thinkphp/tests/thinkphp/library/think/cookieTest.php

@@ -1,150 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Cookie测试
- * @author    Haotong Lin <lofanmi@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use ReflectionClass;
-use think\Cookie;
-
-class cookieTest extends \PHPUnit_Framework_TestCase
-{
-    protected $ref;
-
-    protected $default = [
-        // cookie 名称前缀
-        'prefix'    => '',
-        // cookie 保存时间
-        'expire'    => 0,
-        // cookie 保存路径
-        'path'      => '/',
-        // cookie 有效域名
-        'domain'    => '',
-        //  cookie 启用安全传输
-        'secure'    => false,
-        // httponly设置
-        'httponly'  => '',
-        // 是否使用 setcookie
-        'setcookie' => false,
-    ];
-
-    protected function setUp()
-    {
-        $reflectedClass          = new ReflectionClass('\think\Cookie');
-        $reflectedPropertyConfig = $reflectedClass->getProperty('config');
-        $reflectedPropertyConfig->setAccessible(true);
-        $reflectedPropertyConfig->setValue($this->default);
-        $this->ref = $reflectedPropertyConfig;
-    }
-
-    public function testInit()
-    {
-        $config = [
-            // cookie 名称前缀
-            'prefix'   => 'think_',
-            // cookie 保存时间
-            'expire'   => 0,
-            // cookie 保存路径
-            'path'     => '/path/to/test/',
-            // cookie 有效域名
-            'domain'   => '.thinkphp.cn',
-            //  cookie 启用安全传输
-            'secure'   => true,
-            // httponly设置
-            'httponly' => '1',
-        ];
-        Cookie::init($config);
-
-        $this->assertEquals(
-            array_merge($this->default, array_change_key_case($config)),
-            $this->ref->getValue()
-        );
-    }
-
-    public function testPrefix()
-    {
-        $this->assertEquals($this->default['prefix'], Cookie::prefix());
-
-        $prefix = '_test_';
-        $this->assertNotEquals($prefix, Cookie::prefix());
-        Cookie::prefix($prefix);
-
-        $config = $this->ref->getValue();
-        $this->assertEquals($prefix, $config['prefix']);
-    }
-
-    public function testSet()
-    {
-        $value = 'value';
-
-        $name = 'name1';
-        Cookie::set($name, $value, 10);
-        $this->assertEquals($value, $_COOKIE[$this->default['prefix'] . $name]);
-
-        $name = 'name2';
-        Cookie::set($name, $value, null);
-        $this->assertEquals($value, $_COOKIE[$this->default['prefix'] . $name]);
-
-        $name = 'name3';
-        Cookie::set($name, $value, 'expire=100&prefix=pre_');
-        $this->assertEquals($value, $_COOKIE['pre_' . $name]);
-
-        $name  = 'name4';
-        $value = ['_test_中文_'];
-        Cookie::set($name, $value);
-        $this->assertEquals('think:' . json_encode([urlencode('_test_中文_')]), $_COOKIE[$name]);
-    }
-
-    public function testGet()
-    {
-        $_COOKIE = [
-            'a'       => 'b',
-            'pre_abc' => 'c',
-            'd'       => 'think:' . json_encode([urlencode('_test_中文_')]),
-        ];
-        $this->assertEquals('b', Cookie::get('a'));
-        $this->assertEquals(null, Cookie::get('does_not_exist'));
-        $this->assertEquals('c', Cookie::get('abc', 'pre_'));
-        $this->assertEquals(['_test_中文_'], Cookie::get('d'));
-    }
-
-    public function testDelete()
-    {
-        $_COOKIE = [
-            'a'       => 'b',
-            'pre_abc' => 'c',
-        ];
-        $this->assertEquals('b', Cookie::get('a'));
-        Cookie::delete('a');
-        $this->assertEquals(null, Cookie::get('a'));
-
-        $this->assertEquals('c', Cookie::get('abc', 'pre_'));
-        Cookie::delete('abc', 'pre_');
-        $this->assertEquals(null, Cookie::get('abc', 'pre_'));
-    }
-
-    public function testClear()
-    {
-        $_COOKIE = [];
-        $this->assertEquals(null, Cookie::clear());
-
-        $_COOKIE = [
-            'a'       => 'b',
-            'pre_abc' => 'c',
-        ];
-        Cookie::clear('pre_');
-        $this->assertEquals(['a' => 'b'], $_COOKIE);
-    }
-}

+ 0 - 2
thinkphp/tests/thinkphp/library/think/db/driver/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 0 - 352
thinkphp/tests/thinkphp/library/think/dbTest.php

@@ -1,352 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Db类测试
- * @author: 刘志淳 <chun@engineer.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Db;
-
-class dbTest extends \PHPUnit_Framework_TestCase
-{
-    // 获取测试数据库配置
-    private function getConfig()
-    {
-        return [
-            // 数据库类型
-            'type'           => 'mysql',
-            // 服务器地址
-            'hostname'       => '127.0.0.1',
-            // 数据库名
-            'database'       => 'test',
-            // 用户名
-            'username'       => 'root',
-            // 密码
-            'password'       => '',
-            // 端口
-            'hostport'       => '',
-            // 连接dsn
-            'dsn'            => '',
-            // 数据库连接参数
-            'params'         => [],
-            // 数据库编码默认采用utf8
-            'charset'        => 'utf8',
-            // 数据库表前缀
-            'prefix'         => 'tp_',
-            // 数据库调试模式
-            'debug'          => true,
-            // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
-            'deploy'         => 0,
-            // 数据库读写是否分离 主从式有效
-            'rw_separate'    => false,
-            // 读写分离后 主服务器数量
-            'master_num'     => 1,
-            // 指定从服务器序号
-            'slave_no'       => '',
-            // 是否严格检查字段是否存在
-            'fields_strict'  => true,
-            // 数据集返回类型 array 数组 collection Collection对象
-            'resultset_type' => 'array',
-            // 是否自动写入时间戳字段
-            'auto_timestamp' => false,
-            // 是否需要进行SQL性能分析
-            'sql_explain'    => false,
-        ];
-    }
-
-    // 获取创建数据库 SQL
-    private function getCreateTableSql()
-    {
-        $sql[] = <<<EOF
-DROP TABLE IF EXISTS `tp_user`;
-EOF;
-        $sql[] = <<<EOF
-CREATE TABLE `tp_user` (
-  `id` int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-  `username` char(40) NOT NULL DEFAULT '' COMMENT '用户名',
-  `password` char(40) NOT NULL DEFAULT '' COMMENT '密码',
-  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
-  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间'
-) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='会员表';
-EOF;
-        $sql[] = <<<EOF
-ALTER TABLE `tp_user` ADD INDEX(`create_time`);
-EOF;
-        $sql[] = <<<EOF
-DROP TABLE IF EXISTS `tp_order`;
-EOF;
-        $sql[] = <<<EOF
-CREATE TABLE `tp_order` (
-  `id` int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-  `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
-  `sn` char(20) NOT NULL DEFAULT '' COMMENT '订单号',
-  `amount` decimal(10,2) unsigned NOT NULL DEFAULT '0' COMMENT '金额',
-  `freight_fee` decimal(10,2) unsigned NOT NULL DEFAULT '0' COMMENT '运费',
-  `address_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '地址id',
-  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
-  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间'
-) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='订单表';
-EOF;
-        $sql[] = <<<EOF
-DROP TABLE IF EXISTS `tp_user_address`;
-EOF;
-        $sql[] = <<<EOF
-CREATE TABLE `tp_user_address` (
-  `id` int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-  `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
-  `consignee` varchar(60) NOT NULL DEFAULT '' COMMENT '收货人',
-  `area_info` varchar(50) NOT NULL DEFAULT '' COMMENT '地区信息',
-  `city_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '城市id',
-  `area_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '地区id',
-  `address` varchar(120) NOT NULL DEFAULT '' COMMENT '地址',
-  `tel` varchar(60) NOT NULL DEFAULT '' COMMENT '电话',
-  `mobile` varchar(60) NOT NULL DEFAULT '' COMMENT '手机',
-  `isdefault` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否默认'
-) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='地址表';
-EOF;
-        $sql[] = <<<EOF
-DROP TABLE IF EXISTS `tp_role_user`;
-EOF;
-        $sql[] = <<<EOF
-CREATE TABLE `tp_role_user` (
-  `role_id` smallint(5) unsigned NOT NULL,
-  `user_id` int(10) unsigned NOT NULL,
-  `remark` varchar(250) NOT NULL DEFAULT '',
-  PRIMARY KEY (`role_id`,`user_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-EOF;
-
-        return $sql;
-    }
-
-    public function testConnect()
-    {
-        $config = $this->getConfig();
-        $result = Db::connect($config)->execute('show databases');
-        $this->assertNotEmpty($result);
-    }
-
-    public function testExecute()
-    {
-        $config = $this->getConfig();
-        $sql    = $this->getCreateTableSql();
-        foreach ($sql as $one) {
-            Db::connect($config)->execute($one);
-        }
-        $tableNum = Db::connect($config)->execute("show tables;");
-        $this->assertEquals(4, $tableNum);
-    }
-
-    public function testQuery()
-    {
-        $config = $this->getConfig();
-        $sql    = $this->getCreateTableSql();
-        Db::connect($config)->batchQuery($sql);
-
-        $tableQueryResult = Db::connect($config)->query("show tables;");
-
-        $this->assertTrue(is_array($tableQueryResult));
-
-        $tableNum = count($tableQueryResult);
-        $this->assertEquals(4, $tableNum);
-    }
-
-    public function testBatchQuery()
-    {
-        $config = $this->getConfig();
-        $sql    = $this->getCreateTableSql();
-        Db::connect($config)->batchQuery($sql);
-
-        $tableNum = Db::connect($config)->execute("show tables;");
-        $this->assertEquals(4, $tableNum);
-    }
-
-    public function testTable()
-    {
-        $config    = $this->getConfig();
-        $tableName = 'tp_user';
-        $result    = Db::connect($config)->table($tableName);
-        $this->assertEquals($tableName, $result->getOptions()['table']);
-    }
-
-    public function testName()
-    {
-        $config    = $this->getConfig();
-        $tableName = 'user';
-        $result    = Db::connect($config)->name($tableName);
-        $this->assertEquals($config['prefix'] . $tableName, $result->getTable());
-    }
-
-    public function testInsert()
-    {
-        $config = $this->getConfig();
-        $data   = [
-            'username'    => 'chunice',
-            'password'    => md5('chunice'),
-            'status'      => 1,
-            'create_time' => time(),
-        ];
-        $result = Db::connect($config)->name('user')->insert($data);
-        $this->assertEquals(1, $result);
-    }
-
-    public function testUpdate()
-    {
-        $config = $this->getConfig();
-        $data   = [
-            'username'    => 'chunice_update',
-            'password'    => md5('chunice'),
-            'status'      => 1,
-            'create_time' => time(),
-        ];
-        $result = Db::connect($config)->name('user')->where('username', 'chunice')->update($data);
-        $this->assertEquals(1, $result);
-    }
-
-    public function testFind()
-    {
-        $config   = $this->getConfig();
-        $mustFind = Db::connect($config)->name('user')->where('username', 'chunice_update')->find();
-        $this->assertNotEmpty($mustFind);
-        $mustNotFind = Db::connect($config)->name('user')->where('username', 'chunice')->find();
-        $this->assertEmpty($mustNotFind);
-    }
-
-    public function testInsertAll()
-    {
-        $config = $this->getConfig();
-
-        $data = [
-            ['username' => 'foo', 'password' => md5('foo'), 'status' => 1, 'create_time' => time()],
-            ['username' => 'bar', 'password' => md5('bar'), 'status' => 1, 'create_time' => time()],
-        ];
-
-        $insertNum = Db::connect($config)->name('user')->insertAll($data);
-        $this->assertEquals(count($data), $insertNum);
-    }
-
-    public function testSelect()
-    {
-        $config    = $this->getConfig();
-        $mustFound = Db::connect($config)->name('user')->where('status', 1)->select();
-        $this->assertNotEmpty($mustFound);
-        $mustNotFound = Db::connect($config)->name('user')->where('status', 0)->select();
-        $this->assertEmpty($mustNotFound);
-    }
-
-    public function testValue()
-    {
-        $config   = $this->getConfig();
-        $username = Db::connect($config)->name('user')->where('id', 1)->value('username');
-        $this->assertEquals('chunice_update', $username);
-        $usernameNull = Db::connect($config)->name('user')->where('id', 0)->value('username');
-        $this->assertEmpty($usernameNull);
-    }
-
-    public function testColumn()
-    {
-        $config   = $this->getConfig();
-        $username = Db::connect($config)->name('user')->where('status', 1)->column('username');
-        $this->assertNotEmpty($username);
-        $usernameNull = Db::connect($config)->name('user')->where('status', 0)->column('username');
-        $this->assertEmpty($usernameNull);
-
-    }
-
-    public function testInsertGetId()
-    {
-        $config = $this->getConfig();
-        $id     = Db::connect($config)->name('user')->order('id', 'desc')->value('id');
-
-        $data = [
-            'username'    => uniqid(),
-            'password'    => md5('chunice'),
-            'status'      => 1,
-            'create_time' => time(),
-        ];
-        $lastId = Db::connect($config)->name('user')->insertGetId($data);
-        $this->assertEquals($id + 1, $lastId);
-
-    }
-
-    public function testGetLastInsId()
-    {
-        $config = $this->getConfig();
-        $data   = [
-            'username'    => uniqid(),
-            'password'    => md5('chunice'),
-            'status'      => 1,
-            'create_time' => time(),
-        ];
-        $lastId = Db::connect($config)->name('user')->insertGetId($data);
-
-        $lastInsId = Db::connect($config)->name('user')->getLastInsID();
-        $this->assertEquals($lastId, $lastInsId);
-    }
-
-    public function testSetField()
-    {
-        $config = $this->getConfig();
-
-        $setFieldNum = Db::connect($config)->name('user')->where('id', 1)->setField('username', 'chunice_setField');
-        $this->assertEquals(1, $setFieldNum);
-
-        $setFieldNum = Db::connect($config)->name('user')->where('id', 1)->setField('username', 'chunice_setField');
-        $this->assertEquals(0, $setFieldNum);
-    }
-
-    public function testSetInc()
-    {
-        $config           = $this->getConfig();
-        $originCreateTime = Db::connect($config)->name('user')->where('id', 1)->value('create_time');
-        Db::connect($config)->name('user')->where('id', 1)->setInc('create_time');
-        $newCreateTime = Db::connect($config)->name('user')->where('id', 1)->value('create_time');
-        $this->assertEquals($originCreateTime + 1, $newCreateTime);
-
-    }
-
-    public function testSetDec()
-    {
-        $config           = $this->getConfig();
-        $originCreateTime = Db::connect($config)->name('user')->where('id', 1)->value('create_time');
-        Db::connect($config)->name('user')->where('id', 1)->setDec('create_time');
-        $newCreateTime = Db::connect($config)->name('user')->where('id', 1)->value('create_time');
-        $this->assertEquals($originCreateTime - 1, $newCreateTime);
-    }
-
-    public function testDelete()
-    {
-        $config = $this->getConfig();
-        Db::connect($config)->name('user')->where('id', 1)->delete();
-        $result = Db::connect($config)->name('user')->where('id', 1)->find();
-        $this->assertEmpty($result);
-    }
-
-    public function testChunk()
-    {
-        // todo 暂未想到测试方法
-    }
-
-    public function testCache()
-    {
-        $config = $this->getConfig();
-        $result = Db::connect($config)->name('user')->where('id', 1)->cache('key', 60)->find();
-        $cache  = \think\Cache::get('key');
-        $this->assertEquals($result, $cache);
-
-        $updateCache = Db::connect($config)->name('user')->cache('key')->find(1);
-        $this->assertEquals($cache, $updateCache);
-    }
-
-}

+ 0 - 220
thinkphp/tests/thinkphp/library/think/debugTest.php

@@ -1,220 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Debug测试
- * @author    大漠 <zhylninc@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use tests\thinkphp\library\think\config\ConfigInitTrait;
-use think\Config;
-use think\Debug;
-use think\Response;
-use think\response\Redirect;
-
-class debugTest extends \PHPUnit_Framework_TestCase
-{
-    use ConfigInitTrait;
-
-    /**
-     *
-     * @var Debug
-     */
-    protected $object;
-
-    /**
-     * Sets up the fixture, for example, opens a network connection.
-     * This method is called before a test is executed.
-     */
-    protected function setUp()
-    {
-        $this->object = new Debug();
-    }
-
-    /**
-     * Tears down the fixture, for example, closes a network connection.
-     * This method is called after a test is executed.
-     */
-    protected function tearDown()
-    {}
-
-    /**
-     * @covers \think\Debug::remark
-     * @todo Implement testRemark().
-     */
-    public function testRemark()
-    {
-        $name = "testremarkkey";
-        Debug::remark($name);
-    }
-
-    /**
-     * @covers \think\Debug::getRangeTime
-     * @todo Implement testGetRangeTime().
-     */
-    public function testGetRangeTime()
-    {
-        $start = "testGetRangeTimeStart";
-        $end   = "testGetRangeTimeEnd";
-        Debug::remark($start);
-        usleep(20000);
-        // \think\Debug::remark($end);
-
-        $time = Debug::getRangeTime($start, $end);
-        $this->assertLessThan(0.03, $time);
-        //$this->assertEquals(0.03, ceil($time));
-    }
-
-    /**
-     * @covers \think\Debug::getUseTime
-     * @todo Implement testGetUseTime().
-     */
-    public function testGetUseTime()
-    {
-        $time = Debug::getUseTime();
-        $this->assertLessThan(30, $time);
-    }
-
-    /**
-     * @covers \think\Debug::getThroughputRate
-     * @todo Implement testGetThroughputRate().
-     */
-    public function testGetThroughputRate()
-    {
-        usleep(100000);
-        $throughputRate = Debug::getThroughputRate();
-        $this->assertLessThan(10, $throughputRate);
-    }
-
-    /**
-     * @covers \think\Debug::getRangeMem
-     * @todo Implement testGetRangeMem().
-     */
-    public function testGetRangeMem()
-    {
-        $start = "testGetRangeMemStart";
-        $end   = "testGetRangeMemEnd";
-        Debug::remark($start);
-        $str = "";
-        for ($i = 0; $i < 10000; $i++) {
-            $str .= "mem";
-        }
-
-        $rangeMem = Debug::getRangeMem($start, $end);
-
-        $this->assertLessThan(33, explode(" ", $rangeMem)[0]);
-    }
-
-    /**
-     * @covers \think\Debug::getUseMem
-     * @todo Implement testGetUseMem().
-     */
-    public function testGetUseMem()
-    {
-        $useMem = Debug::getUseMem();
-
-        $this->assertLessThan(35, explode(" ", $useMem)[0]);
-    }
-
-    /**
-     * @covers \think\Debug::getMemPeak
-     * @todo Implement testGetMemPeak().
-     */
-    public function testGetMemPeak()
-    {
-        $start = "testGetMemPeakStart";
-        $end   = "testGetMemPeakEnd";
-        Debug::remark($start);
-        $str = "";
-        for ($i = 0; $i < 100000; $i++) {
-            $str .= "mem";
-        }
-        $memPeak = Debug::getMemPeak($start, $end);
-        $this->assertLessThan(500, explode(" ", $memPeak)[0]);
-    }
-
-    /**
-     * @covers \think\Debug::getFile
-     * @todo Implement testGetFile().
-     */
-    public function testGetFile()
-    {
-        $count = Debug::getFile();
-
-        $this->assertEquals(count(get_included_files()), $count);
-
-        $info = Debug::getFile(true);
-        $this->assertEquals(count(get_included_files()), count($info));
-
-        $this->assertContains("KB", $info[0]);
-    }
-
-    /**
-     * @covers \think\Debug::dump
-     * @todo Implement testDump().
-     */
-    public function testDump()
-    {
-        if (strstr(PHP_VERSION, 'hhvm')) {
-            return;
-        }
-
-        $var        = [];
-        $var["key"] = "val";
-        $output     = Debug::dump($var, false, $label = "label");
-        $array      = explode("array", json_encode($output));
-        if (IS_WIN) {
-            $this->assertEquals("(1) {\\n  [\\\"key\\\"] => string(3) \\\"val\\\"\\n}\\n\\r\\n\"", end($array));
-        } elseif (strstr(PHP_OS, 'Darwin')) {
-            $this->assertEquals("(1) {\\n  [\\\"key\\\"] => string(3) \\\"val\\\"\\n}\\n\\n\"", end($array));
-        } else {
-            $this->assertEquals("(1) {\\n  'key' =>\\n  string(3) \\\"val\\\"\\n}\\n\\n\"", end($array));
-        }
-    }
-
-    /**
-     * @expectedException \think\exception\ClassNotFoundException
-     */
-    public function testInjectWithErrorType()
-    {
-        Config::set('trace', ['type' => 'NullDebug']);
-
-        $response = new Response();
-        $context  = 'TestWithErrorType';
-
-        Debug::inject($response, $context);
-    }
-
-    public function testInject()
-    {
-        Config::set('trace', ['type' => 'Console']);
-
-        $response = new Response();
-        $context  = 'TestWithoutBodyTag';
-        Debug::inject($response, $context);
-        $this->assertNotEquals('TestWithoutBodyTag', $context);
-        $this->assertStringStartsWith('TestWithoutBodyTag', $context);
-
-        $response = new Response();
-        $context  = '<body></body>';
-        Debug::inject($response, $context);
-        $this->assertNotEquals('<body></body>', $context);
-        $this->assertStringStartsWith('<body>', $context);
-        $this->assertStringEndsWith('</body>', $context);
-
-        $response = new Redirect();
-        $context  = '<body></body>';
-        Debug::inject($response, $context);
-        $this->assertEquals('<body></body>', $context);
-    }
-}

+ 0 - 52
thinkphp/tests/thinkphp/library/think/exceptionTest.php

@@ -1,52 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * exception类测试
- * @author    Haotong Lin <lofanmi@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use ReflectionMethod;
-use think\Exception as ThinkException;
-use think\exception\HttpException;
-
-class MyException extends ThinkException
-{
-
-}
-
-class exceptionTest extends \PHPUnit_Framework_TestCase
-{
-    public function testGetHttpStatus()
-    {
-        try {
-            throw new HttpException(404, "Error Processing Request");
-        } catch (HttpException $e) {
-            $this->assertEquals(404, $e->getStatusCode());
-        }
-    }
-
-    public function testDebugData()
-    {
-        $data = ['a' => 'b', 'c' => 'd'];
-        try {
-            $e      = new MyException("Error Processing Request", 1);
-            $method = new ReflectionMethod($e, 'setData');
-            $method->setAccessible(true);
-            $method->invokeArgs($e, ['test', $data]);
-            throw $e;
-        } catch (MyException $e) {
-            $this->assertEquals(['test' => $data], $e->getData());
-        }
-    }
-}

+ 0 - 67
thinkphp/tests/thinkphp/library/think/hookTest.php

@@ -1,67 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Hook类测试
- * @author    liu21st <liu21st@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Hook;
-
-class hookTest extends \PHPUnit_Framework_TestCase
-{
-
-    public function testRun()
-    {
-        Hook::add('my_pos', '\tests\thinkphp\library\think\behavior\One');
-        Hook::add('my_pos', ['\tests\thinkphp\library\think\behavior\Two']);
-        Hook::add('my_pos', '\tests\thinkphp\library\think\behavior\Three', true);
-        $data['id']   = 0;
-        $data['name'] = 'thinkphp';
-        Hook::listen('my_pos', $data);
-        $this->assertEquals(2, $data['id']);
-        $this->assertEquals('thinkphp', $data['name']);
-        $this->assertEquals([
-            '\tests\thinkphp\library\think\behavior\Three',
-            '\tests\thinkphp\library\think\behavior\One',
-            '\tests\thinkphp\library\think\behavior\Two'],
-            Hook::get('my_pos'));
-    }
-
-    public function testImport()
-    {
-        Hook::import(['my_pos' => [
-            '\tests\thinkphp\library\think\behavior\One',
-            '\tests\thinkphp\library\think\behavior\Three'],
-        ]);
-        Hook::import(['my_pos' => ['\tests\thinkphp\library\think\behavior\Two']], false);
-        Hook::import(['my_pos' => ['\tests\thinkphp\library\think\behavior\Three', '_overlay' => true]]);
-        $data['id']   = 0;
-        $data['name'] = 'thinkphp';
-        Hook::listen('my_pos', $data);
-        $this->assertEquals(3, $data['id']);
-
-    }
-
-    public function testExec()
-    {
-        $data['id']   = 0;
-        $data['name'] = 'thinkphp';
-        $this->assertEquals(true, Hook::exec('\tests\thinkphp\library\think\behavior\One'));
-        $this->assertEquals(false, Hook::exec('\tests\thinkphp\library\think\behavior\One', 'test', $data));
-        $this->assertEquals('test', $data['name']);
-        $this->assertEquals('Closure', Hook::exec(function (&$data) {$data['name'] = 'Closure';return 'Closure';}));
-
-    }
-
-}

+ 0 - 4
thinkphp/tests/thinkphp/library/think/lang/lang.php

@@ -1,4 +0,0 @@
-<?php
-return [
-    'load'=>'加载',
-];

+ 0 - 76
thinkphp/tests/thinkphp/library/think/langTest.php

@@ -1,76 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Lang测试
- * @author    liu21st <liu21st@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Config;
-use think\Lang;
-
-class langTest extends \PHPUnit_Framework_TestCase
-{
-
-    public function testSetAndGet()
-    {
-        Lang::set('hello,%s', '欢迎,%s');
-        $this->assertEquals('欢迎,ThinkPHP', Lang::get('hello,%s', ['ThinkPHP']));
-        Lang::set('hello,%s', '歡迎,%s', 'zh-tw');
-        $this->assertEquals('歡迎,ThinkPHP', Lang::get('hello,%s', ['ThinkPHP'], 'zh-tw'));
-        Lang::set(['hello' => '欢迎', 'use' => '使用']);
-        $this->assertEquals('欢迎', Lang::get('hello'));
-        $this->assertEquals('欢迎', Lang::get('HELLO'));
-        $this->assertEquals('使用', Lang::get('use'));
-
-        Lang::set('hello,{:name}', '欢迎,{:name}');
-        $this->assertEquals('欢迎,liu21st', Lang::get('hello,{:name}', ['name' => 'liu21st']));
-    }
-
-    public function testLoad()
-    {
-        Lang::load(__DIR__ . DS . 'lang' . DS . 'lang.php');
-        $this->assertEquals('加载', Lang::get('load'));
-        Lang::load(__DIR__ . DS . 'lang' . DS . 'lang.php', 'test');
-        $this->assertEquals('加载', Lang::get('load', [], 'test'));
-    }
-
-    public function testDetect()
-    {
-
-        Config::set('lang_list', ['zh-cn', 'zh-tw']);
-        Lang::set('hello', '欢迎', 'zh-cn');
-        Lang::set('hello', '歡迎', 'zh-tw');
-
-        Config::set('lang_detect_var', 'lang');
-        Config::set('lang_cookie_var', 'think_cookie');
-
-        $_GET['lang'] = 'zh-tw';
-        Lang::detect();
-        $this->assertEquals('歡迎', Lang::get('hello'));
-
-        $_GET['lang'] = 'zh-cn';
-        Lang::detect();
-        $this->assertEquals('欢迎', Lang::get('hello'));
-
-    }
-
-    public function testRange()
-    {
-        $this->assertEquals('zh-cn', Lang::range());
-        Lang::set('hello', '欢迎', 'test');
-        Lang::range('test');
-        $this->assertEquals('test', Lang::range());
-        $this->assertEquals('欢迎', Lang::get('hello'));
-    }
-}

+ 0 - 7
thinkphp/tests/thinkphp/library/think/loader/test/Hello.php

@@ -1,7 +0,0 @@
-<?php
-namespace top\test;
-
-class Hello
-{
-
-}

+ 0 - 71
thinkphp/tests/thinkphp/library/think/loaderTest.php

@@ -1,71 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Loader测试
- * @author    liu21st <liu21st@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Loader;
-
-class loaderTest extends \PHPUnit_Framework_TestCase
-{
-
-    public function testAutoload()
-    {
-        $this->assertEquals(false, Loader::autoload('\think\Url'));
-        $this->assertEquals(false, Loader::autoload('think\Test'));
-        $this->assertEquals(false, Loader::autoload('my\HelloTest'));
-    }
-
-    public function testAddClassMap()
-    {
-        Loader::addClassMap('my\hello\Test', __DIR__ . DS . 'loader' . DS . 'Test.php');
-    }
-
-    public function testAddNamespace()
-    {
-        Loader::addNamespace('top', __DIR__ . DS . 'loader' . DS);
-        $this->assertEquals(true, Loader::autoload('top\test\Hello'));
-    }
-
-    public function testAddNamespaceAlias()
-    {
-        Loader::addNamespaceAlias('top', 'top\test');
-        Loader::addNamespaceAlias(['top' => 'top\test', 'app' => 'app\index']);
-        //$this->assertEquals(true, Loader::autoload('top\Hello'));
-    }
-
-    public function testTable()
-    {
-        Loader::db('mysql://root@127.0.0.1/test#utf8');
-    }
-
-    public function testImport()
-    {
-        $this->assertEquals(false, Loader::import('think.log.driver.MyTest'));
-    }
-
-    public function testParseName()
-    {
-        $this->assertEquals('HelloTest', Loader::parseName('hello_test', 1));
-        $this->assertEquals('hello_test', Loader::parseName('HelloTest', 0));
-    }
-
-    public function testParseClass()
-    {
-        $this->assertEquals('app\index\controller\User', Loader::parseClass('index', 'controller', 'user'));
-        $this->assertEquals('app\index\controller\user\Type', Loader::parseClass('index', 'controller', 'user.type'));
-        $this->assertEquals('app\admin\model\UserType', Loader::parseClass('admin', 'model', 'user_type'));
-    }
-}

+ 0 - 34
thinkphp/tests/thinkphp/library/think/log/driver/fileTest.php

@@ -1,34 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Test File Log
- */
-namespace tests\thinkphp\library\think\log\driver;
-
-use think\Log;
-
-class fileTest extends \PHPUnit_Framework_TestCase
-{
-    protected function setUp()
-    {
-        Log::init(['type' => 'file']);
-    }
-
-    public function testRecord()
-    {
-        $record_msg = 'record';
-        Log::record($record_msg, 'notice');
-        $logs = Log::getLog();
-
-        $this->assertEquals([], $logs);
-    }
-}

+ 0 - 39
thinkphp/tests/thinkphp/library/think/logTest.php

@@ -1,39 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Log测试
- * @author    liu21st <liu21st@gmail.com>
- */
-namespace tests\thinkphp\library\think;
-
-use think\Log;
-
-class logTest extends \PHPUnit_Framework_TestCase
-{
-
-    public function testSave()
-    {
-        Log::init(['type' => 'test']);
-        Log::clear();
-        Log::record('test');
-        Log::record([1, 2, 3]);
-        $this->assertTrue(Log::save());
-    }
-
-    public function testWrite()
-    {
-        Log::init(['type' => 'test']);
-        Log::clear();
-        $this->assertTrue(Log::write('hello', 'info'));
-        $this->assertTrue(Log::write([1, 2, 3], 'log'));
-    }
-}

+ 0 - 2
thinkphp/tests/thinkphp/library/think/model/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

Файловите разлики са ограничени, защото са твърде много
+ 0 - 40
thinkphp/tests/thinkphp/library/think/paginateTest.php


+ 0 - 203
thinkphp/tests/thinkphp/library/think/requestTest.php

@@ -1,203 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Db类测试
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Config;
-use think\Request;
-
-class requestTest extends \PHPUnit_Framework_TestCase
-{
-    protected $request;
-
-    public function setUp()
-    {
-        //$request = Request::create('http://www.domain.com/index/index/hello/?name=thinkphp');
-
-    }
-
-    public function testCreate()
-    {
-        $request = Request::create('http://www.thinkphp.cn/index/index/hello.html?name=thinkphp');
-        $this->assertEquals('http://www.thinkphp.cn', $request->domain());
-        $this->assertEquals('/index/index/hello.html?name=thinkphp', $request->url());
-        $this->assertEquals('/index/index/hello.html', $request->baseurl());
-        $this->assertEquals('index/index/hello.html', $request->pathinfo());
-        $this->assertEquals('index/index/hello', $request->path());
-        $this->assertEquals('html', $request->ext());
-        $this->assertEquals('name=thinkphp', $request->query());
-        $this->assertEquals('www.thinkphp.cn', $request->host());
-        $this->assertEquals(80, $request->port());
-        $this->assertEquals($_SERVER['REQUEST_TIME'], $request->time());
-        $this->assertEquals($_SERVER['REQUEST_TIME_FLOAT'], $request->time(true));
-        $this->assertEquals('GET', $request->method());
-        $this->assertEquals(['name' => 'thinkphp'], $request->param());
-        $this->assertFalse($request->isSsl());
-        $this->assertEquals('http', $request->scheme());
-    }
-
-    public function testDomain()
-    {
-        $request = Request::instance();
-        $request->domain('http://thinkphp.cn');
-        $this->assertEquals('http://thinkphp.cn', $request->domain());
-    }
-
-    public function testUrl()
-    {
-        $request = Request::instance();
-        $request->url('/index.php/index/hello?name=thinkphp');
-        $this->assertEquals('/index.php/index/hello?name=thinkphp', $request->url());
-        $this->assertEquals('http://thinkphp.cn/index.php/index/hello?name=thinkphp', $request->url(true));
-    }
-
-    public function testBaseUrl()
-    {
-        $request = Request::instance();
-        $request->baseurl('/index.php/index/hello');
-        $this->assertEquals('/index.php/index/hello', $request->baseurl());
-        $this->assertEquals('http://thinkphp.cn/index.php/index/hello', $request->baseurl(true));
-    }
-
-    public function testbaseFile()
-    {
-        $request = Request::instance();
-        $request->basefile('/index.php');
-        $this->assertEquals('/index.php', $request->basefile());
-        $this->assertEquals('http://thinkphp.cn/index.php', $request->basefile(true));
-    }
-
-    public function testroot()
-    {
-        $request = Request::instance();
-        $request->root('/index.php');
-        $this->assertEquals('/index.php', $request->root());
-        $this->assertEquals('http://thinkphp.cn/index.php', $request->root(true));
-    }
-
-    public function testType()
-    {
-        $request = Request::instance();
-        $request->server(['HTTP_ACCEPT' => 'application/json']);
-
-        $this->assertEquals('json', $request->type());
-        $request->mimeType('test', 'application/test');
-        $request->mimeType(['test' => 'application/test']);
-        $request->server(['HTTP_ACCEPT' => 'application/test']);
-
-        $this->assertEquals('test', $request->type());
-    }
-
-    public function testmethod()
-    {
-        $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'DELETE';
-
-        $request = Request::create('', '');
-        $this->assertEquals('DELETE', $request->method());
-        $this->assertEquals('GET', $request->method(true));
-
-        Config::set('var_method', '_method');
-        $_POST['_method'] = 'POST';
-        $request          = Request::create('', '');
-        $this->assertEquals('POST', $request->method());
-        $this->assertEquals('GET', $request->method(true));
-        $this->assertTrue($request->isPost());
-        $this->assertFalse($request->isGet());
-        $this->assertFalse($request->isPut());
-        $this->assertFalse($request->isDelete());
-        $this->assertFalse($request->isHead());
-        $this->assertFalse($request->isPatch());
-        $this->assertFalse($request->isOptions());
-    }
-
-    public function testCli()
-    {
-        $request = Request::instance();
-        $this->assertTrue($request->isCli());
-    }
-
-    public function testVar()
-    {
-        Config::set('app_multi_module', true);
-        $request = Request::create('');
-        $request->route(['name' => 'thinkphp', 'id' => 6]);
-        $request->get(['id' => 10]);
-        $request->post(['id' => 8]);
-        $request->put(['id' => 7]);
-        $request->request(['test' => 'value']);
-        $this->assertEquals(['name' => 'thinkphp', 'id' => 6], $request->route());
-        //$this->assertEquals(['id' => 10], $request->get());
-        $this->assertEquals('thinkphp', $request->route('name'));
-        $this->assertEquals('default', $request->route('test', 'default'));
-        $this->assertEquals(10, $request->get('id'));
-        $this->assertEquals(0, $request->get('ids', 0));
-        $this->assertEquals(8, $request->post('id'));
-        $this->assertEquals(7, $request->put('id'));
-        $this->assertEquals('value', $request->request('test'));
-        $this->assertEquals('thinkphp', $request->param('name'));
-        $this->assertEquals(6, $request->param('id'));
-        $this->assertFalse($request->has('user_id'));
-        $this->assertTrue($request->has('test', 'request'));
-        $this->assertEquals(['id' => 6], $request->only('id'));
-        $this->assertEquals(['name' => 'thinkphp', 'lang' => 'zh-cn'], $request->except('id'));
-        $this->assertEquals('THINKPHP', $request->param('name', '', 'strtoupper'));
-    }
-
-    public function testIsAjax()
-    {
-        $request = Request::create('');
-
-        $this->assertFalse($request->isAjax());
-
-        $_SERVER['HTTP_X_REQUESTED_WITH'] = 'xmlhttprequest';
-        $this->assertFalse($request->isAjax());
-        $this->assertFalse($request->isAjax(true));
-
-        $request->server(['HTTP_X_REQUESTED_WITH' => 'xmlhttprequest']);
-        $this->assertTrue($request->isAjax());
-    }
-
-    public function testIsPjax()
-    {
-        $request = Request::create('');
-
-        $this->assertFalse($request->isPjax());
-
-        $_SERVER['HTTP_X_PJAX'] = true;
-        $this->assertFalse($request->isPjax());
-        $this->assertFalse($request->isPjax(true));
-
-        $request->server(['HTTP_X_PJAX' => true]);
-        $this->assertTrue($request->isPjax());
-        $request->server(['HTTP_X_PJAX' => false]);
-        $this->assertTrue($request->isPjax());
-    }
-
-    public function testIsMobile()
-    {
-        $request             = Request::create('');
-        $_SERVER['HTTP_VIA'] = 'wap';
-        $this->assertTrue($request->isMobile());
-    }
-
-    public function testBind()
-    {
-        $request       = Request::create('');
-        $request->user = 'User1';
-        $request->bind(['user' => 'User2']);
-        $this->assertEquals('User2', $request->user);
-    }
-
-}

+ 0 - 95
thinkphp/tests/thinkphp/library/think/responseTest.php

@@ -1,95 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Response测试
- * @author    大漠 <zhylninc@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Config;
-use think\Request;
-use think\Response;
-
-class responseTest extends \PHPUnit_Framework_TestCase
-{
-
-    /**
-     *
-     * @var \think\Response
-     */
-    protected $object;
-
-    protected $default_return_type;
-
-    protected $default_ajax_return;
-
-    /**
-     * Sets up the fixture, for example, opens a network connection.
-     * This method is called before a test is executed.
-     */
-    protected function setUp()
-    {
-        // 1.
-        // restore_error_handler();
-        // Warning: Cannot modify header information - headers already sent by (output started at PHPUnit\Util\Printer.php:173)
-        // more see in https://www.analysisandsolutions.com/blog/html/writing-phpunit-tests-for-wordpress-plugins-wp-redirect-and-continuing-after-php-errors.htm
-
-        // 2.
-        // the Symfony used the HeaderMock.php
-
-        // 3.
-        // not run the eclipse will held, and travis-ci.org Searching for coverage reports
-        // **> Python coverage not found
-        // **> No coverage report found.
-        // add the
-        // /**
-        // * @runInSeparateProcess
-        // */
-        if (!$this->default_return_type) {
-            $this->default_return_type = Config::get('default_return_type');
-        }
-        if (!$this->default_ajax_return) {
-            $this->default_ajax_return = Config::get('default_ajax_return');
-        }
-    }
-
-    /**
-     * Tears down the fixture, for example, closes a network connection.
-     * This method is called after a test is executed.
-     */
-    protected function tearDown()
-    {
-        Config::set('default_ajax_return', $this->default_ajax_return);
-        Config::set('default_return_type', $this->default_return_type);
-    }
-
-    /**
-     * @covers think\Response::send
-     * @todo Implement testSend().
-     */
-    public function testSend()
-    {
-        $dataArr        = [];
-        $dataArr["key"] = "value";
-
-        $response = Response::create($dataArr, 'json');
-        $result   = $response->getContent();
-        $this->assertEquals('{"key":"value"}', $result);
-        $request = Request::instance();
-        $request->get(['callback' => 'callback']);
-        $response = Response::create($dataArr, 'jsonp');
-        $result   = $response->getContent();
-        $this->assertEquals('callback({"key":"value"});', $result);
-    }
-
-}

+ 0 - 287
thinkphp/tests/thinkphp/library/think/routeTest.php

@@ -1,287 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Route测试
- * @author    liu21st <liu21st@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Config;
-use think\Request;
-use think\Route;
-
-class routeTest extends \PHPUnit_Framework_TestCase
-{
-
-    protected function setUp()
-    {
-        Config::set('app_multi_module', true);
-    }
-
-    public function testRegister()
-    {
-        $request = Request::instance();
-        Route::get('hello/:name', 'index/hello');
-        Route::get(['hello/:name' => 'index/hello']);
-        Route::post('hello/:name', 'index/post');
-        Route::put('hello/:name', 'index/put');
-        Route::delete('hello/:name', 'index/delete');
-        Route::patch('hello/:name', 'index/patch');
-        Route::any('user/:id', 'index/user');
-        $result = Route::check($request, 'hello/thinkphp');
-        $this->assertEquals([null, 'index', 'hello'], $result['module']);
-        $this->assertEquals(['hello' => true, 'user/:id' => true, 'hello/:name' => ['rule' => 'hello/:name', 'route' => 'index/hello', 'var' => ['name' => 1], 'option' => [], 'pattern' => []]], Route::rules('GET'));
-        Route::rule('type1/:name', 'index/type', 'PUT|POST');
-        Route::rule(['type2/:name' => 'index/type1']);
-        Route::rule([['type3/:name', 'index/type2', ['method' => 'POST']]]);
-        Route::rule(['name', 'type4/:name'], 'index/type4');
-    }
-
-    public function testImport()
-    {
-        $rule = [
-            '__domain__' => ['subdomain2.thinkphp.cn' => 'blog1'],
-            '__alias__'  => ['blog1' => 'blog1'],
-            '__rest__'   => ['res' => ['index/blog']],
-            'bbb'        => ['index/blog1', ['method' => 'POST']],
-            'ddd'        => '',
-            ['hello1/:ddd', 'index/hello1', ['method' => 'POST']],
-        ];
-        Route::import($rule);
-    }
-
-    public function testResource()
-    {
-        $request = Request::instance();
-        Route::resource('res', 'index/blog');
-        Route::resource(['res' => ['index/blog']]);
-        $result = Route::check($request, 'res');
-        $this->assertEquals(['index', 'blog', 'index'], $result['module']);
-        $result = Route::check($request, 'res/create');
-        $this->assertEquals(['index', 'blog', 'create'], $result['module']);
-        $result = Route::check($request, 'res/8');
-        $this->assertEquals(['index', 'blog', 'read'], $result['module']);
-        $result = Route::check($request, 'res/8/edit');
-        $this->assertEquals(['index', 'blog', 'edit'], $result['module']);
-
-        Route::resource('blog.comment', 'index/comment');
-        $result = Route::check($request, 'blog/8/comment/10');
-        $this->assertEquals(['index', 'comment', 'read'], $result['module']);
-        $result = Route::check($request, 'blog/8/comment/10/edit');
-        $this->assertEquals(['index', 'comment', 'edit'], $result['module']);
-
-    }
-
-    public function testRest()
-    {
-        $request = Request::instance();
-        Route::rest('read', ['GET', '/:id', 'look']);
-        Route::rest('create', ['GET', '/create', 'add']);
-        Route::rest(['read' => ['GET', '/:id', 'look'], 'create' => ['GET', '/create', 'add']]);
-        Route::resource('res', 'index/blog');
-        $result = Route::check($request, 'res/create');
-        $this->assertEquals(['index', 'blog', 'add'], $result['module']);
-        $result = Route::check($request, 'res/8');
-        $this->assertEquals(['index', 'blog', 'look'], $result['module']);
-
-    }
-
-    public function testMixVar()
-    {
-        $request = Request::instance();
-        Route::get('hello-<name>', 'index/hello', [], ['name' => '\w+']);
-        $result = Route::check($request, 'hello-thinkphp');
-        $this->assertEquals([null, 'index', 'hello'], $result['module']);
-        Route::get('hello-<name><id?>', 'index/hello', [], ['name' => '\w+', 'id' => '\d+']);
-        $result = Route::check($request, 'hello-thinkphp2016');
-        $this->assertEquals([null, 'index', 'hello'], $result['module']);
-        Route::get('hello-<name>/[:id]', 'index/hello', [], ['name' => '\w+', 'id' => '\d+']);
-        $result = Route::check($request, 'hello-thinkphp/2016');
-        $this->assertEquals([null, 'index', 'hello'], $result['module']);
-    }
-
-    public function testParseUrl()
-    {
-        $result = Route::parseUrl('hello');
-        $this->assertEquals(['hello', null, null], $result['module']);
-        $result = Route::parseUrl('index/hello');
-        $this->assertEquals(['index', 'hello', null], $result['module']);
-        $result = Route::parseUrl('index/hello?name=thinkphp');
-        $this->assertEquals(['index', 'hello', null], $result['module']);
-        $result = Route::parseUrl('index/user/hello');
-        $this->assertEquals(['index', 'user', 'hello'], $result['module']);
-        $result = Route::parseUrl('index/user/hello/name/thinkphp');
-        $this->assertEquals(['index', 'user', 'hello'], $result['module']);
-        $result = Route::parseUrl('index-index-hello', '-');
-        $this->assertEquals(['index', 'index', 'hello'], $result['module']);
-    }
-
-    public function testCheckRoute()
-    {
-        Route::get('hello/:name', 'index/hello');
-        Route::get('blog/:id', 'blog/read', [], ['id' => '\d+']);
-        $request = Request::instance();
-        $this->assertEquals(false, Route::check($request, 'test/thinkphp'));
-        $this->assertEquals(false, Route::check($request, 'blog/thinkphp'));
-        $result = Route::check($request, 'blog/5');
-        $this->assertEquals([null, 'blog', 'read'], $result['module']);
-        $result = Route::check($request, 'hello/thinkphp/abc/test');
-        $this->assertEquals([null, 'index', 'hello'], $result['module']);
-    }
-
-    public function testCheckRouteGroup()
-    {
-        $request = Request::instance();
-        Route::pattern(['id' => '\d+']);
-        Route::pattern('name', '\w{6,25}');
-        Route::group('group', [':id' => 'index/hello', ':name' => 'index/say']);
-        $this->assertEquals(false, Route::check($request, 'empty/think'));
-        $result = Route::check($request, 'group/think');
-        $this->assertEquals(false, $result['module']);
-        $result = Route::check($request, 'group/10');
-        $this->assertEquals([null, 'index', 'hello'], $result['module']);
-        $result = Route::check($request, 'group/thinkphp');
-        $this->assertEquals([null, 'index', 'say'], $result['module']);
-        Route::group('group2', function () {
-            Route::group('group3', [':id' => 'index/hello', ':name' => 'index/say']);
-            Route::rule(':name', 'index/hello');
-            Route::auto('index');
-        });
-        $result = Route::check($request, 'group2/thinkphp');
-        $this->assertEquals([null, 'index', 'hello'], $result['module']);
-        $result = Route::check($request, 'group2/think');
-        $this->assertEquals(['index', 'group2', 'think'], $result['module']);
-        $result = Route::check($request, 'group2/group3/thinkphp');
-        $this->assertEquals([null, 'index', 'say'], $result['module']);
-        Route::group('group4', function () {
-            Route::group('group3', [':id' => 'index/hello', ':name' => 'index/say']);
-            Route::rule(':name', 'index/hello');
-            Route::miss('index/__miss__');
-        });
-        $result = Route::check($request, 'group4/thinkphp');
-        $this->assertEquals([null, 'index', 'hello'], $result['module']);
-        $result = Route::check($request, 'group4/think');
-        $this->assertEquals([null, 'index', '__miss__'], $result['module']);
-
-        Route::group(['prefix' => 'prefix/'], function () {
-            Route::rule('hello4/:name', 'hello');
-        });
-        Route::group(['prefix' => 'prefix/'], [
-            'hello4/:name' => 'hello',
-        ]);
-        $result = Route::check($request, 'hello4/thinkphp');
-        $this->assertEquals([null, 'prefix', 'hello'], $result['module']);
-        Route::group('group5', [
-            [':name', 'hello', ['method' => 'GET|POST']],
-            ':id' => 'hello',
-        ], ['prefix' => 'prefix/']);
-        $result = Route::check($request, 'group5/thinkphp');
-        $this->assertEquals([null, 'prefix', 'hello'], $result['module']);
-    }
-
-    public function testControllerRoute()
-    {
-        $request = Request::instance();
-        Route::controller('controller', 'index/Blog');
-        $result = Route::check($request, 'controller/info');
-        $this->assertEquals(['index', 'Blog', 'getinfo'], $result['module']);
-        Route::setMethodPrefix('GET', 'read');
-        Route::setMethodPrefix(['get' => 'read']);
-        Route::controller('controller', 'index/Blog');
-        $result = Route::check($request, 'controller/phone');
-        $this->assertEquals(['index', 'Blog', 'readphone'], $result['module']);
-    }
-
-    public function testAliasRoute()
-    {
-        $request = Request::instance();
-        Route::alias('alias', 'index/Alias');
-        $result = Route::check($request, 'alias/info');
-        $this->assertEquals('index/Alias/info', $result['module']);
-    }
-
-    public function testRouteToModule()
-    {
-        $request = Request::instance();
-        Route::get('hello/:name', 'index/hello');
-        Route::get('blog/:id', 'blog/read', [], ['id' => '\d+']);
-        $this->assertEquals(false, Route::check($request, 'test/thinkphp'));
-        $this->assertEquals(false, Route::check($request, 'blog/thinkphp'));
-        $result = Route::check($request, 'hello/thinkphp');
-        $this->assertEquals([null, 'index', 'hello'], $result['module']);
-        $result = Route::check($request, 'blog/5');
-        $this->assertEquals([null, 'blog', 'read'], $result['module']);
-    }
-
-    public function testRouteToController()
-    {
-        $request = Request::instance();
-        Route::get('say/:name', '@index/hello');
-        $this->assertEquals(['type' => 'controller', 'controller' => 'index/hello', 'var' => []], Route::check($request, 'say/thinkphp'));
-    }
-
-    public function testRouteToMethod()
-    {
-        $request = Request::instance();
-        Route::get('user/:name', '\app\index\service\User::get', [], ['name' => '\w+']);
-        Route::get('info/:name', '\app\index\model\Info@getInfo', [], ['name' => '\w+']);
-        $this->assertEquals(['type' => 'method', 'method' => '\app\index\service\User::get', 'var' => []], Route::check($request, 'user/thinkphp'));
-        $this->assertEquals(['type' => 'method', 'method' => ['\app\index\model\Info', 'getInfo'], 'var' => []], Route::check($request, 'info/thinkphp'));
-    }
-
-    public function testRouteToRedirect()
-    {
-        $request = Request::instance();
-        Route::get('art/:id', '/article/read/id/:id', [], ['id' => '\d+']);
-        $this->assertEquals(['type' => 'redirect', 'url' => '/article/read/id/8', 'status' => 301], Route::check($request, 'art/8'));
-    }
-
-    public function testBind()
-    {
-        $request = Request::instance();
-        Route::bind('index/blog');
-        Route::get('blog/:id', 'index/blog/read');
-        $result = Route::check($request, 'blog/10');
-        $this->assertEquals(['index', 'blog', 'read'], $result['module']);
-        $result = Route::parseUrl('test');
-        $this->assertEquals(['index', 'blog', 'test'], $result['module']);
-
-        Route::bind('\app\index\controller', 'namespace');
-        $this->assertEquals(['type' => 'method', 'method' => ['\app\index\controller\Blog', 'read'], 'var' => []], Route::check($request, 'blog/read'));
-
-        Route::bind('\app\index\controller\Blog', 'class');
-        $this->assertEquals(['type' => 'method', 'method' => ['\app\index\controller\Blog', 'read'], 'var' => []], Route::check($request, 'read'));
-    }
-
-    public function testDomain()
-    {
-        $request = Request::create('http://subdomain.thinkphp.cn');
-        Route::domain('subdomain.thinkphp.cn', 'sub?abc=test&status=1');
-        $rules = Route::rules('GET');
-        Route::checkDomain($request, $rules);
-        $this->assertEquals('sub', Route::getbind('module'));
-        $this->assertEquals('test', $_GET['abc']);
-        $this->assertEquals(1, $_GET['status']);
-
-        Route::domain('subdomain.thinkphp.cn', '\app\index\controller');
-        $rules = Route::rules('GET');
-        Route::checkDomain($request, $rules);
-        $this->assertEquals('\app\index\controller', Route::getbind('namespace'));
-
-        Route::domain(['subdomain.thinkphp.cn' => '@\app\index\controller\blog']);
-        $rules = Route::rules('GET');
-        Route::checkDomain($request, $rules);
-        $this->assertEquals('\app\index\controller\blog', Route::getbind('class'));
-
-    }
-}

+ 0 - 2
thinkphp/tests/thinkphp/library/think/session/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 0 - 319
thinkphp/tests/thinkphp/library/think/sessionTest.php

@@ -1,319 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Session测试
- * @author    大漠 <zhylninc@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Session;
-
-class sessionTest extends \PHPUnit_Framework_TestCase
-{
-
-    /**
-     *
-     * @var \think\Session
-     */
-    protected $object;
-
-    /**
-     * Sets up the fixture, for example, opens a network connection.
-     * This method is called before a test is executed.
-     */
-    protected function setUp()
-    {
-        // $this->object = new Session ();
-        // register_shutdown_function ( function () {
-        // } ); // 此功能无法取消,需要回调函数配合。
-        set_exception_handler(function () {});
-        set_error_handler(function () {});
-    }
-
-    /**
-     * Tears down the fixture, for example, closes a network connection.
-     * This method is called after a test is executed.
-     */
-    protected function tearDown()
-    {
-        register_shutdown_function('think\Error::appShutdown');
-        set_error_handler('think\Error::appError');
-        set_exception_handler('think\Error::appException');
-    }
-
-    /**
-     * @covers think\Session::prefix
-     *
-     * @todo Implement testPrefix().
-     */
-    public function testPrefix()
-    {
-        Session::prefix(null);
-        Session::prefix('think_');
-
-        $this->assertEquals('think_', Session::prefix());
-    }
-
-    /**
-     * @covers think\Session::init
-     *
-     * @todo Implement testInit().
-     */
-    public function testInit()
-    {
-        Session::prefix(null);
-        $config = [
-            // cookie 名称前缀
-            'prefix'         => 'think_',
-            // cookie 保存时间
-            'expire'         => 60,
-            // cookie 保存路径
-            'path'           => '/path/to/test/session/',
-            // cookie 有效域名
-            'domain'         => '.thinkphp.cn',
-            'var_session_id' => 'sessionidtest',
-            'id'             => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
-            'name'           => 'session_name',
-            'use_trans_sid'  => '1',
-            'use_cookies'    => '1',
-            'cache_limiter'  => '60',
-            'cache_expire'   => '60',
-            'type'           => '', // memcache
-            'namespace'      => '\\think\\session\\driver\\', // ?
-            'auto_start'     => '1',
-        ];
-
-        $_REQUEST[$config['var_session_id']] = $config['id'];
-        Session::init($config);
-
-        // 开始断言
-        $this->assertEquals($config['prefix'], Session::prefix());
-        $this->assertEquals($config['id'], $_REQUEST[$config['var_session_id']]);
-        $this->assertEquals($config['name'], session_name());
-
-        $this->assertEquals($config['path'], session_save_path());
-        $this->assertEquals($config['use_cookies'], ini_get('session.use_cookies'));
-        $this->assertEquals($config['domain'], ini_get('session.cookie_domain'));
-        $this->assertEquals($config['expire'], ini_get('session.gc_maxlifetime'));
-        $this->assertEquals($config['expire'], ini_get('session.cookie_lifetime'));
-
-        $this->assertEquals($config['cache_limiter'], session_cache_limiter($config['cache_limiter']));
-        $this->assertEquals($config['cache_expire'], session_cache_expire($config['cache_expire']));
-
-        // 检测分支
-        $_REQUEST[$config['var_session_id']] = null;
-        session_write_close();
-        session_destroy();
-
-        Session::init($config);
-
-        // 测试auto_start
-        // PHP_SESSION_DISABLED
-        // PHP_SESSION_NONE
-        // PHP_SESSION_ACTIVE
-        // session_status()
-        if (strstr(PHP_VERSION, 'hhvm')) {
-            $this->assertEquals('', ini_get('session.auto_start'));
-        } else {
-            $this->assertEquals(0, ini_get('session.auto_start'));
-        }
-
-        $this->assertEquals($config['use_trans_sid'], ini_get('session.use_trans_sid'));
-
-        Session::init($config);
-        $this->assertEquals($config['id'], session_id());
-    }
-
-    /**
-     * 单独重现异常
-     * @expectedException \think\Exception
-     */
-    public function testException()
-    {
-        $config = [
-            // cookie 名称前缀
-            'prefix'         => 'think_',
-            // cookie 保存时间
-            'expire'         => 0,
-            // cookie 保存路径
-            'path'           => '/path/to/test/session/',
-            // cookie 有效域名
-            'domain'         => '.thinkphp.cn',
-            'var_session_id' => 'sessionidtest',
-            'id'             => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
-            'name'           => 'session_name',
-            'use_trans_sid'  => '1',
-            'use_cookies'    => '1',
-            'cache_limiter'  => '60',
-            'cache_expire'   => '60',
-            'type'           => '\\think\\session\\driver\\Memcache', //
-            'auto_start'     => '1',
-        ];
-
-        // 测试session驱动是否存在
-        // @expectedException 异常类名
-        $this->setExpectedException('\think\exception\ClassNotFoundException', 'error session handler');
-
-        Session::init($config);
-    }
-
-    /**
-     * @covers think\Session::set
-     *
-     * @todo Implement testSet().
-     */
-    public function testSet()
-    {
-        Session::prefix(null);
-        Session::set('sessionname', 'sessionvalue');
-        $this->assertEquals('sessionvalue', $_SESSION['sessionname']);
-
-        Session::set('sessionnamearr.subname', 'sessionvalue');
-        $this->assertEquals('sessionvalue', $_SESSION['sessionnamearr']['subname']);
-
-        Session::set('sessionnameper', 'sessionvalue', 'think_');
-        $this->assertEquals('sessionvalue', $_SESSION['think_']['sessionnameper']);
-
-        Session::set('sessionnamearrper.subname', 'sessionvalue', 'think_');
-        $this->assertEquals('sessionvalue', $_SESSION['think_']['sessionnamearrper']['subname']);
-    }
-
-    /**
-     * @covers think\Session::get
-     *
-     * @todo Implement testGet().
-     */
-    public function testGet()
-    {
-        Session::prefix(null);
-
-        Session::set('sessionnameget', 'sessionvalue');
-        $this->assertEquals(Session::get('sessionnameget'), $_SESSION['sessionnameget']);
-
-        Session::set('sessionnamegetarr.subname', 'sessionvalue');
-        $this->assertEquals(Session::get('sessionnamegetarr.subname'), $_SESSION['sessionnamegetarr']['subname']);
-
-        Session::set('sessionnamegetarrperall', 'sessionvalue', 'think_');
-        $this->assertEquals(Session::get('', 'think_')['sessionnamegetarrperall'], $_SESSION['think_']['sessionnamegetarrperall']);
-
-        Session::set('sessionnamegetper', 'sessionvalue', 'think_');
-        $this->assertEquals(Session::get('sessionnamegetper', 'think_'), $_SESSION['think_']['sessionnamegetper']);
-
-        Session::set('sessionnamegetarrper.subname', 'sessionvalue', 'think_');
-        $this->assertEquals(Session::get('sessionnamegetarrper.subname', 'think_'), $_SESSION['think_']['sessionnamegetarrper']['subname']);
-    }
-
-    public function testPull()
-    {
-        Session::prefix(null);
-        Session::set('sessionnamedel', 'sessionvalue');
-        $this->assertEquals('sessionvalue', Session::pull('sessionnameget'));
-        $this->assertNull(Session::get('sessionnameget'));
-    }
-
-    /**
-     * @covers think\Session::delete
-     *
-     * @todo Implement testDelete().
-     */
-    public function testDelete()
-    {
-        Session::prefix(null);
-        Session::set('sessionnamedel', 'sessionvalue');
-        Session::delete('sessionnamedel');
-        $this->assertEmpty($_SESSION['sessionnamedel']);
-
-        Session::set('sessionnamedelarr.subname', 'sessionvalue');
-        Session::delete('sessionnamedelarr.subname');
-        $this->assertEmpty($_SESSION['sessionnamedelarr']['subname']);
-
-        Session::set('sessionnamedelper', 'sessionvalue', 'think_');
-        Session::delete('sessionnamedelper', 'think_');
-        $this->assertEmpty($_SESSION['think_']['sessionnamedelper']);
-
-        Session::set('sessionnamedelperarr.subname', 'sessionvalue', 'think_');
-        Session::delete('sessionnamedelperarr.subname', 'think_');
-        $this->assertEmpty($_SESSION['think_']['sessionnamedelperarr']['subname']);
-    }
-
-    /**
-     * @covers think\Session::clear
-     *
-     * @todo Implement testClear().
-     */
-    public function testClear()
-    {
-        Session::prefix(null);
-
-        Session::set('sessionnameclsper', 'sessionvalue1', 'think_');
-        Session::clear('think_');
-        $this->assertNull($_SESSION['think_']);
-
-        Session::set('sessionnameclsper', 'sessionvalue1', 'think_');
-        Session::clear();
-        $this->assertEmpty($_SESSION);
-    }
-
-    /**
-     * @covers think\Session::has
-     *
-     * @todo Implement testHas().
-     */
-    public function testHas()
-    {
-        Session::prefix(null);
-        Session::set('sessionnamehas', 'sessionvalue');
-        $this->assertTrue(Session::has('sessionnamehas'));
-
-        Session::set('sessionnamehasarr.subname', 'sessionvalue');
-        $this->assertTrue(Session::has('sessionnamehasarr.subname'));
-
-        Session::set('sessionnamehasper', 'sessionvalue', 'think_');
-        $this->assertTrue(Session::has('sessionnamehasper', 'think_'));
-
-        Session::set('sessionnamehasarrper.subname', 'sessionvalue', 'think_');
-        $this->assertTrue(Session::has('sessionnamehasarrper.subname', 'think_'));
-    }
-
-    /**
-     * @covers think\Session::pause
-     *
-     * @todo Implement testPause().
-     */
-    public function testPause()
-    {
-        Session::pause();
-    }
-
-    /**
-     * @covers think\Session::start
-     *
-     * @todo Implement testStart().
-     */
-    public function testStart()
-    {
-        Session::start();
-    }
-
-    /**
-     * @covers think\Session::destroy
-     *
-     * @todo Implement testDestroy().
-     */
-    public function testDestroy()
-    {
-        Session::set('sessionnamedestroy', 'sessionvalue');
-        Session::destroy();
-        $this->assertEmpty($_SESSION['sessionnamedestroy']);
-    }
-}

+ 0 - 2
thinkphp/tests/thinkphp/library/think/template/driver/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 0 - 575
thinkphp/tests/thinkphp/library/think/template/taglib/cxTest.php

@@ -1,575 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * 模板测试
- * @author    Haotong Lin <lofanmi@gmail.com>
- */
-
-namespace tests\thinkphp\library\think\tempplate\taglib;
-
-use think\Template;
-use think\template\taglib\Cx;
-
-class cxTest extends \PHPUnit_Framework_TestCase
-{
-    public function testPhp()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{php}echo \$a;{/php}
-EOF;
-        $data = <<<EOF
-<?php echo \$a; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-    }
-
-    public function testVolist()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{volist name="list" id="vo" key="key"}
-
-{/volist}
-EOF;
-        $data = <<<EOF
-<?php if(is_array(\$list) || \$list instanceof \\think\\Collection || \$list instanceof \\think\\Paginator): \$key = 0; \$__LIST__ = \$list;if( count(\$__LIST__)==0 ) : echo "" ;else: foreach(\$__LIST__ as \$key=>\$vo): \$mod = (\$key % 2 );++\$key;?>
-
-<?php endforeach; endif; else: echo "" ;endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($data, $content);
-
-        $content = <<<EOF
-{volist name="\$list" id="vo" key="key" offset="1" length="3"}
-{\$vo}
-{/volist}
-EOF;
-
-        $template->display($content, ['list' => [1, 2, 3, 4, 5]]);
-        $this->expectOutputString('234');
-    }
-
-    public function testForeach()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{foreach \$list as \$key=>\$val}
-
-{/foreach}
-EOF;
-        $data = <<<EOF
-<?php foreach(\$list as \$key=>\$val): ?>
-
-<?php endforeach; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{foreach name="list" id="val" key="key" empty="empty"}
-
-{/foreach}
-EOF;
-        $data = <<<EOF
-<?php if(is_array(\$list) || \$list instanceof \\think\\Collection || \$list instanceof \\think\\Paginator): if( count(\$list)==0 ) : echo "empty" ;else: foreach(\$list as \$key=>\$val): ?>
-
-<?php endforeach; endif; else: echo "empty" ;endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{foreach name=":explode(',', '1,2,3,4,5')" id="val" key="key" index="index" mod="2" offset="1" length="3"}
-{\$val}
-{/foreach}
-EOF;
-        $template->display($content);
-        $this->expectOutputString('234');
-    }
-
-    public function testIf()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{if \$var.a==\$var.b}
-one
-{elseif !empty(\$var.a) /}
-two
-{else /}
-default
-{/if}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a']==\$var['b']): ?>
-one
-<?php elseif(!empty(\$var['a'])): ?>
-two
-<?php else: ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-    }
-
-    public function testSwitch()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{switch \$var}
-{case \$a /}
-a
-{/case}
-{case b|c}
-b
-{/case}
-{case d}
-d
-{/case}
-{default /}
-default
-{/switch}
-EOF;
-        $data = <<<EOF
-<?php switch(\$var): ?>
-<?php case \$a: ?>
-a
-<?php break; ?>
-<?php case "b":case "c": ?>
-b
-<?php break; ?>
-<?php case "d": ?>
-d
-<?php break; ?>
-<?php default: ?>
-default
-<?php endswitch; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-    }
-
-    public function testCompare()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{eq name="\$var.a" value="\$var.b"}
-default
-{/eq}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] == \$var['b']): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{equal name="\$var.a" value="0"}
-default
-{/equal}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] == '0'): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{neq name="\$var.a" value="0"}
-default
-{/neq}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] != '0'): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{notequal name="\$var.a" value="0"}
-default
-{/notequal}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] != '0'): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{gt name="\$var.a" value="0"}
-default
-{/gt}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] > '0'): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{egt name="\$var.a" value="0"}
-default
-{/egt}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] >= '0'): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{lt name="\$var.a" value="0"}
-default
-{/lt}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] < '0'): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{elt name="\$var.a" value="0"}
-default
-{/elt}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] <= '0'): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{heq name="\$var.a" value="0"}
-default
-{/heq}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] === '0'): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{nheq name="\$var.a" value="0"}
-default
-{/nheq}
-EOF;
-        $data = <<<EOF
-<?php if(\$var['a'] !== '0'): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-    }
-
-    public function testRange()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{in name="var" value="\$value"}
-default
-{/in}
-EOF;
-        $data = <<<EOF
-<?php if(in_array((\$var), is_array(\$value)?\$value:explode(',',\$value))): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{notin name="var" value="1,2,3"}
-default
-{/notin}
-EOF;
-        $data = <<<EOF
-<?php if(!in_array((\$var), explode(',',"1,2,3"))): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{between name=":floor(5.1)" value="1,5"}yes{/between}
-{notbetween name=":ceil(5.1)" value="1,5"}no{/notbetween}
-EOF;
-        $template->display($content);
-        $this->expectOutputString('yesno');
-    }
-
-    public function testPresent()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{present name="var"}
-default
-{/present}
-EOF;
-        $data = <<<EOF
-<?php if(isset(\$var)): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{notpresent name="var"}
-default
-{/notpresent}
-EOF;
-        $data = <<<EOF
-<?php if(!isset(\$var)): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-    }
-
-    public function testEmpty()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{empty name="var"}
-default
-{/empty}
-EOF;
-        $data = <<<EOF
-<?php if(empty(\$var) || ((\$var instanceof \\think\\Collection || \$var instanceof \\think\\Paginator ) && \$var->isEmpty())): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{notempty name="var"}
-default
-{/notempty}
-EOF;
-        $data = <<<EOF
-<?php if(!(empty(\$var) || ((\$var instanceof \\think\\Collection || \$var instanceof \\think\\Paginator ) && \$var->isEmpty()))): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-    }
-
-    public function testDefined()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{defined name="URL"}
-default
-{/defined}
-EOF;
-        $data = <<<EOF
-<?php if(defined("URL")): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{notdefined name="URL"}
-default
-{/notdefined}
-EOF;
-        $data = <<<EOF
-<?php if(!defined("URL")): ?>
-default
-<?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-    }
-
-    public function testImport()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{load file="base.php" value="\$name.a" /}
-EOF;
-        $data = <<<EOF
-<?php if(isset(\$name['a'])): ?><?php include "base.php"; ?><?php endif; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{js file="base.js" /}
-EOF;
-        $data = <<<EOF
-<script type="text/javascript" src="base.js"></script>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{css file="base.css" /}
-EOF;
-        $data = <<<EOF
-<link rel="stylesheet" type="text/css" href="base.css" />
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-    }
-
-    public function testAssign()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{assign name="total" value="0" /}
-EOF;
-        $data = <<<EOF
-<?php \$total = '0'; ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{assign name="total" value=":count(\$list)" /}
-EOF;
-        $data = <<<EOF
-<?php \$total = count(\$list); ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-    }
-
-    public function testDefine()
-    {
-        $template = new template();
-        $cx       = new Cx($template);
-
-        $content = <<<EOF
-{define name="INFO_NAME" value="test" /}
-EOF;
-        $data = <<<EOF
-<?php define('INFO_NAME', 'test'); ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-
-        $content = <<<EOF
-{define name="INFO_NAME" value="\$name" /}
-EOF;
-        $data = <<<EOF
-<?php define('INFO_NAME', \$name); ?>
-EOF;
-        $cx->parseTag($content);
-        $this->assertEquals($content, $data);
-    }
-
-    public function testFor()
-    {
-        $template = new template();
-
-        $content = <<<EOF
-{for start="1" end=":strlen(1000000000)" comparison="lt" step="1" name="i" }
-{\$i}
-{/for}
-EOF;
-        $template->display($content);
-        $this->expectOutputString('123456789');
-    }
-    public function testUrl()
-    {
-        $template = new template();
-        $content  = <<<EOF
-{url link="Index/index"  /}
-EOF;
-        $template->display($content);
-        $this->expectOutputString(\think\Url::build('Index/index'));
-    }
-
-    public function testFunction()
-    {
-        $template = new template();
-        $data     = [
-            'list' => ['language' => 'php', 'version' => ['5.4', '5.5']],
-            'a'    => '[',
-            'b'    => ']',
-        ];
-
-        $content = <<<EOF
-{function name="func" vars="\$data" call="\$list" use="&\$a,&\$b"}
-{foreach \$data as \$key=>\$val}
-{if is_array(\$val)}
-{~\$func(\$val)}
-{else}
-{if !is_numeric(\$key)}
-{\$key.':'.\$val.','}
-{else}
-{\$a.\$val.\$b}
-{/if}
-{/if}
-{/foreach}
-{/function}
-EOF;
-        $template->display($content, $data);
-        $this->expectOutputString("language:php,[5.4][5.5]");
-    }
-}

+ 0 - 415
thinkphp/tests/thinkphp/library/think/templateTest.php

@@ -1,415 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * 模板测试
- * @author    oldrind
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\Cache;
-use think\Template;
-
-class templateTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var Template
-     */
-    protected $template;
-
-    public function setUp()
-    {
-        $this->template = new Template();
-    }
-
-    public function testAssign()
-    {
-        $reflectProperty = new \ReflectionProperty(get_class($this->template), 'data');
-        $reflectProperty->setAccessible(true);
-
-        $this->template->assign('version', 'ThinkPHP3.2');
-        $data = $reflectProperty->getValue($this->template);
-        $this->assertEquals('ThinkPHP3.2', $data['version']);
-
-        $this->template->assign(['name' => 'Gao', 'version' => 'ThinkPHP5']);
-        $data = $reflectProperty->getValue($this->template);
-        $this->assertEquals('Gao', $data['name']);
-        $this->assertEquals('ThinkPHP5', $data['version']);
-    }
-
-    public function testGet()
-    {
-        $this->template = new Template();
-        $data = [
-            'project' => 'ThinkPHP',
-            'version' => [
-                'ThinkPHP5' => ['Think5.0', 'Think5.1']
-            ]
-        ];
-        $this->template->assign($data);
-
-        $this->assertSame($data, $this->template->get());
-        $this->assertSame('ThinkPHP', $this->template->get('project'));
-        $this->assertSame(['Think5.0', 'Think5.1'], $this->template->get('version.ThinkPHP5'));
-        $this->assertNull($this->template->get('version.ThinkPHP3.2'));
-    }
-
-    /**
-     * @dataProvider provideTestParseWithVar
-     */
-    public function testParseWithVar($content, $expected)
-    {
-        $this->template = new Template();
-
-        $this->template->parse($content);
-        $this->assertEquals($expected, $content);
-    }
-
-    /**
-     * @dataProvider provideTestParseWithVarFunction
-     */
-    public function testParseWithVarFunction($content, $expected)
-    {
-        $this->template = new Template();
-
-        $this->template->parse($content);
-        $this->assertEquals($expected, $content);
-    }
-
-    /**
-     * @dataProvider provideTestParseWithVarIdentify
-     */
-    public function testParseWithVarIdentify($content, $expected, $config)
-    {
-        $this->template = new Template($config);
-
-        $this->template->parse($content);
-        $this->assertEquals($expected, $content);
-    }
-
-    /**
-     * @dataProvider provideTestParseWithThinkVar
-     */
-    public function testParseWithThinkVar($content, $expected)
-    {
-        $config['tpl_begin'] = '{';
-        $config['tpl_end']   = '}';
-        $this->template            = new Template($config);
-
-        $_SERVER['SERVER_NAME'] = 'server_name';
-        $_GET['action']         = 'action';
-        $_POST['action']        = 'action';
-        $_COOKIE['name']        = 'name';
-        $_SESSION['action']     = ['name' => 'name'];
-
-        $this->template->parse($content);
-        $this->assertEquals($expected, $content);
-    }
-
-    /**
-     * @expectedException \think\exception\TemplateNotFoundException
-     */
-    public function testFetchWithEmptyTemplate()
-    {
-        $this->template = new Template();
-
-        $this->template->fetch('Foo');
-    }
-
-    /**
-     * @dataProvider provideTestFetchWithNoCache
-     */
-    public function testFetchWithNoCache($data, $expected)
-    {
-        $this->template = new Template();
-
-        $this->template->fetch($data['template'], $data['vars'], $data['config']);
-
-        $this->expectOutputString($expected);
-    }
-
-    public function testFetchWithCache()
-    {
-        $this->template = new Template();
-
-        $data = [
-            'name' => 'value'
-        ];
-        $config = [
-            'cache_id'      => 'TEST_FETCH_WITH_CACHE',
-            'display_cache' => true,
-        ];
-
-        $this->template->fetch(APP_PATH . 'views' . DS .'display.html', $data, $config);
-
-        $this->expectOutputString('value');
-        $this->assertEquals('value', Cache::get($config['cache_id']));
-    }
-
-    public function testDisplay()
-    {
-        $config = [
-            'view_path'   => APP_PATH . DS . 'views' . DS,
-            'view_suffix' => '.html',
-            'layout_on'   => true,
-            'layout_name' => 'layout'
-        ];
-
-        $this->template = new Template($config);
-
-        $this->template->assign('files', ['extend' => 'extend', 'include' => 'include']);
-        $this->template->assign('user', ['name' => 'name', 'account' => 100]);
-        $this->template->assign('message', 'message');
-        $this->template->assign('info', ['value' => 'value']);
-
-        $content = <<<EOF
-{extend name="\$files.extend" /}
-{block name="main"}
-main
-{block name="side"}
-{__BLOCK__}
-    {include file="\$files.include" name="\$user.name" value="\$user.account" /}
-    {\$message}{literal}{\$message}{/literal}
-{/block}
-{block name="mainbody"}
-    mainbody
-{/block}
-{/block}
-EOF;
-        $expected = <<<EOF
-<nav>
-header
-<div id="wrap">
-    <input name="info" value="value">
-value:
-
-main
-
-
-    side
-
-    <input name="name" value="100">
-value:
-    message{\$message}
-
-
-    mainbody
-
-
-
-    {\$name}
-
-    php code</div>
-</nav>
-EOF;
-        $this->template->display($content);
-        $this->expectOutputString($expected);
-    }
-
-    /**
-     * @dataProvider provideTestLayout
-     */
-    public function testLayout($data, $expected)
-    {
-        $this->template = new Template();
-
-        $this->template->layout($data['name'], $data['replace']);
-
-        $this->assertSame($expected['layout_on'], $this->template->config('layout_on'));
-        $this->assertSame($expected['layout_name'], $this->template->config('layout_name'));
-        $this->assertSame($expected['layout_item'], $this->template->config('layout_item'));
-    }
-
-    public function testParseAttr()
-    {
-        $attributes = $this->template->parseAttr("<name version='ThinkPHP' name=\"Gao\"></name>");
-        $this->assertSame(['version' => 'ThinkPHP', 'name' => 'Gao'], $attributes);
-
-        $attributes = $this->template->parseAttr("<name version='ThinkPHP' name=\"Gao\">TestCase</name>", 'version');
-        $this->assertSame('ThinkPHP', $attributes);
-    }
-
-    public function testIsCache()
-    {
-        $this->template = new Template();
-        $config = [
-            'cache_id'      => rand(0, 10000) . rand(0, 10000) . time(),
-            'display_cache' => true
-        ];
-
-        $this->assertFalse($this->template->isCache($config['cache_id']));
-
-        $this->template->fetch(APP_PATH . 'views' . DS .'display.html', [], $config);
-        $this->assertTrue($this->template->isCache($config['cache_id']));
-    }
-
-    public function provideTestParseWithVar()
-    {
-        return [
-            ["{\$name.a.b}", "<?php echo \$name['a']['b']; ?>"],
-            ["{\$name.a??'test'}", "<?php echo isset(\$name['a'])?\$name['a']:'test'; ?>"],
-            ["{\$name.a?='test'}", "<?php if(!empty(\$name['a'])) echo 'test'; ?>"],
-            ["{\$name.a?:'test'}", "<?php echo !empty(\$name['a'])?\$name['a']:'test'; ?>"],
-            ["{\$name.a?\$name.b:'no'}", "<?php echo !empty(\$name['a'])?\$name['b']:'no'; ?>"],
-            ["{\$name.a==\$name.b?='test'}", "<?php if(\$name['a']==\$name['b']) echo 'test'; ?>"],
-            ["{\$name.a==\$name.b?'a':'b'}", "<?php echo \$name['a']==\$name['b']?'a':'b'; ?>"],
-            ["{\$name.a|default='test'==\$name.b?'a':'b'}", "<?php echo (isset(\$name['a']) && (\$name['a'] !== '')?\$name['a']:'test')==\$name['b']?'a':'b'; ?>"],
-            ["{\$name.a|trim==\$name.b?='eq'}", "<?php if(trim(\$name['a'])==\$name['b']) echo 'eq'; ?>"],
-            ["{:ltrim(rtrim(\$name.a))}", "<?php echo ltrim(rtrim(\$name['a'])); ?>"],
-            ["{~echo(trim(\$name.a))}", "<?php echo(trim(\$name['a'])); ?>"],
-            ["{++\$name.a}", "<?php echo ++\$name['a']; ?>"],
-            ["{/*\$name*/}", ""],
-            ["{\$0a}", "{\$0a}"]
-        ];
-    }
-
-    public function provideTestParseWithVarFunction()
-    {
-        return [
-            ["{\$name.a.b|default='test'}", "<?php echo (isset(\$name['a']['b']) && (\$name['a']['b'] !== '')?\$name['a']['b']:'test'); ?>"],
-            ["{\$create_time|date=\"y-m-d\",###}", "<?php echo date(\"y-m-d\",\$create_time); ?>"],
-            ["{\$name}\n{\$name|trim|substr=0,3}", "<?php echo \$name; ?>\n<?php echo substr(trim(\$name),0,3); ?>"]
-        ];
-    }
-
-    public function provideTestParseWithVarIdentify()
-    {
-        $config['tpl_begin']        = '<#';
-        $config['tpl_end']          = '#>';
-        $config['tpl_var_identify'] = '';
-
-        return [
-            [
-                "<#\$info.a??'test'#>",
-                "<?php echo ((is_array(\$info)?\$info['a']:\$info->a)) ? (is_array(\$info)?\$info['a']:\$info->a) : 'test'; ?>",
-                $config
-            ],
-            [
-                "<#\$info.a?='test'#>",
-                "<?php if((is_array(\$info)?\$info['a']:\$info->a)) echo 'test'; ?>",
-                $config
-            ],
-            [
-                "<#\$info.a==\$info.b?='test'#>",
-                "<?php if((is_array(\$info)?\$info['a']:\$info->a)==(is_array(\$info)?\$info['b']:\$info->b)) echo 'test'; ?>",
-                $config
-            ],
-            [
-                "<#\$info.a|default='test'?'yes':'no'#>",
-                "<?php echo ((is_array(\$info)?\$info['a']:\$info->a) ?: 'test')?'yes':'no'; ?>",
-                $config
-            ],
-            [
-                "{\$info2.b|trim?'yes':'no'}",
-                "<?php echo trim(\$info2->b)?'yes':'no'; ?>",
-                array_merge(['tpl_var_identify' => 'obj'])
-            ]
-        ];
-    }
-
-    public function provideTestParseWithThinkVar()
-    {
-        return [
-            ["{\$Think.SERVER.SERVER_NAME}<br/>", "<?php echo \\think\\Request::instance()->server('SERVER_NAME'); ?><br/>"],
-            ["{\$Think.GET.action}<br/>", "<?php echo \\think\\Request::instance()->get('action'); ?><br/>"],
-            ["{\$Think.POST.action}<br/>", "<?php echo \\think\\Request::instance()->post('action'); ?><br/>"],
-            ["{\$Think.COOKIE.action}<br/>", "<?php echo \\think\\Cookie::get('action'); ?><br/>"],
-            ["{\$Think.COOKIE.action.name}<br/>", "<?php echo \\think\\Cookie::get('action.name'); ?><br/>"],
-            ["{\$Think.SESSION.action}<br/>", "<?php echo \\think\\Session::get('action'); ?><br/>"],
-            ["{\$Think.SESSION.action.name}<br/>", "<?php echo \\think\\Session::get('action.name'); ?><br/>"],
-            ["{\$Think.ENV.OS}<br/>", "<?php echo \\think\\Request::instance()->env('OS'); ?><br/>"],
-            ["{\$Think.REQUEST.action}<br/>", "<?php echo \\think\\Request::instance()->request('action'); ?><br/>"],
-            ["{\$Think.CONST.THINK_VERSION}<br/>", "<?php echo THINK_VERSION; ?><br/>"],
-            ["{\$Think.LANG.action}<br/>", "<?php echo \\think\\Lang::get('action'); ?><br/>"],
-            ["{\$Think.CONFIG.action.name}<br/>", "<?php echo \\think\\Config::get('action.name'); ?><br/>"],
-            ["{\$Think.NOW}<br/>", "<?php echo date('Y-m-d g:i a',time()); ?><br/>"],
-            ["{\$Think.VERSION}<br/>", "<?php echo THINK_VERSION; ?><br/>"],
-            ["{\$Think.LDELIM}<br/>", "<?php echo '{'; ?><br/>"],
-            ["{\$Think.RDELIM}<br/>", "<?php echo '}'; ?><br/>"],
-            ["{\$Think.THINK_VERSION}<br/>", "<?php echo THINK_VERSION; ?><br/>"],
-            ["{\$Think.SITE.URL}", "<?php echo ''; ?>"]
-        ];
-    }
-
-    public function provideTestFetchWithNoCache()
-    {
-        $provideData = [];
-
-        $this->template = [
-            'template' => APP_PATH . 'views' . DS .'display.html',
-            'vars'     => [],
-            'config'   => []
-        ];
-        $expected = 'default';
-        $provideData[] = [$this->template, $expected];
-
-        $this->template = [
-            'template' => APP_PATH . 'views' . DS .'display.html',
-            'vars'     => ['name' => 'ThinkPHP5'],
-            'config'   => []
-        ];
-        $expected = 'ThinkPHP5';
-        $provideData[] = [$this->template, $expected];
-
-        $this->template = [
-            'template' => 'views@display',
-            'vars'     => [],
-            'config'   => [
-                'view_suffix' => 'html'
-            ]
-        ];
-        $expected = 'default';
-        $provideData[] = [$this->template, $expected];
-
-        $this->template = [
-            'template' => 'views@/display',
-            'vars'     => ['name' => 'ThinkPHP5'],
-            'config'   => [
-                'view_suffix' => 'phtml'
-            ]
-        ];
-        $expected = 'ThinkPHP5';
-        $provideData[] = [$this->template, $expected];
-
-        $this->template = [
-            'template' => 'display',
-            'vars'     => ['name' => 'ThinkPHP5'],
-            'config'   => [
-                'view_suffix' => 'html',
-                'view_base'   => APP_PATH . 'views' . DS
-            ]
-        ];
-        $expected = 'ThinkPHP5';
-        $provideData[] = [$this->template, $expected];
-
-        return $provideData;
-    }
-
-    public function provideTestLayout()
-    {
-        $provideData = [];
-
-        $data = ['name' => false, 'replace' => ''];
-        $expected = ['layout_on' => false, 'layout_name' => 'layout', 'layout_item' => '{__CONTENT__}'];
-        $provideData[] = [$data, $expected];
-
-        $data = ['name' => null, 'replace' => ''];
-        $expected = ['layout_on' => true, 'layout_name' => 'layout', 'layout_item' => '{__CONTENT__}'];
-        $provideData[] = [$data, $expected];
-
-        $data = ['name' => 'ThinkName', 'replace' => 'ThinkReplace'];
-        $expected = ['layout_on' => true, 'layout_name' => 'ThinkName', 'layout_item' => 'ThinkReplace'];
-        $provideData[] = [$data, $expected];
-
-        return $provideData;
-    }
-}

+ 0 - 129
thinkphp/tests/thinkphp/library/think/urlTest.php

@@ -1,129 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Url测试
- * @author    liu21st <liu21st@gmail.com>
- */
-
-namespace tests\thinkphp\library\think;
-
-use tests\thinkphp\library\think\config\ConfigInitTrait;
-use think\Config;
-use think\Route;
-use think\Url;
-
-class urlTest extends \PHPUnit_Framework_TestCase
-{
-    use ConfigInitTrait;
-
-    public function setUp()
-    {
-        Route::rules(['get' => [],
-            'post'              => [],
-            'put'               => [],
-            'delete'            => [],
-            'patch'             => [],
-            'head'              => [],
-            'options'           => [],
-            '*'                 => [],
-            'alias'             => [],
-            'domain'            => [],
-            'pattern'           => [],
-            'name'              => []]);
-        Route::name([]);
-    }
-
-    public function testBuildModule()
-    {
-
-        Route::get('blog/:name', 'index/blog');
-        Route::get('blog/:id', 'index/blog');
-        Config::set('pathinfo_depr', '/');
-        Config::set('url_html_suffix', '');
-
-        $this->assertEquals('/blog/thinkphp', Url::build('index/blog?name=thinkphp'));
-        $this->assertEquals('/blog/thinkphp.html', Url::build('index/blog', 'name=thinkphp', 'html'));
-        $this->assertEquals('/blog/10', Url::build('index/blog?id=10'));
-        $this->assertEquals('/blog/10.html', Url::build('index/blog', 'id=10', 'html'));
-
-        Route::get('item-<name><id?>', 'blog/item', [], ['name' => '\w+', 'id' => '\d+']);
-        $this->assertEquals('/item-thinkphp', Url::build('blog/item?name=thinkphp'));
-        $this->assertEquals('/item-thinkphp2016', Url::build('blog/item?name=thinkphp&id=2016'));
-    }
-
-    public function testBuildController()
-    {
-        Config::set('url_html_suffix', '');
-        Route::get('blog/:id', '@index/blog/read');
-        $this->assertEquals('/blog/10.html', Url::build('@index/blog/read', 'id=10', 'html'));
-
-        Route::get('foo/bar', '@foo/bar/index');
-        $this->assertEquals('/foo/bar', Url::build('@foo/bar/index'));
-
-        Route::get('foo/bar/baz', '@foo/bar.BAZ/index');
-        $this->assertEquals('/foo/bar/baz', Url::build('@foo/bar.BAZ/index'));
-    }
-
-    public function testBuildMethod()
-    {
-        Route::get('blog/:id', '\app\index\controller\blog@read');
-        $this->assertEquals('/blog/10.html', Url::build('\app\index\controller\blog@read', 'id=10', 'html'));
-    }
-
-    public function testBuildRoute()
-    {
-        Route::get('blog/:id', 'index/blog');
-        Config::set('url_html_suffix', 'shtml');
-        $this->assertNotEquals('/blog/10.html', Url::build('/blog/10'));
-        $this->assertEquals('/blog/10.shtml', Url::build('/blog/10'));
-    }
-
-    public function testBuildNameRoute()
-    {
-        Route::get(['name', 'blog/:id'], 'index/blog');
-        $this->assertEquals([['blog/:id', ['id' => 1], null, null]], Route::name('name'));
-        Config::set('url_html_suffix', 'shtml');
-        $this->assertEquals('/blog/10.shtml', Url::build('name?id=10'));
-    }
-
-    public function testBuildAnchor()
-    {
-        Route::get('blog/:id', 'index/blog');
-        Config::set('url_html_suffix', 'shtml');
-        $this->assertEquals('/blog/10.shtml#detail', Url::build('index/blog#detail', 'id=10'));
-
-        Config::set('url_common_param', true);
-        $this->assertEquals('/blog/10.shtml?foo=bar#detail', Url::build('index/blog#detail', "id=10&foo=bar"));
-    }
-
-    public function testBuildDomain()
-    {
-        Config::set('url_domain_deploy', true);
-        Route::domain('subdomain.thinkphp.cn', 'admin');
-        $this->assertEquals('http://subdomain.thinkphp.cn/blog/10.html', Url::build('/blog/10'));
-        Route::domain('subdomain.thinkphp.cn', [
-            'hello/:name' => 'index/hello',
-        ]);
-        $this->assertEquals('http://subdomain.thinkphp.cn/hello/thinkphp.html', Url::build('index/hello?name=thinkphp'));
-    }
-
-    public function testRoot()
-    {
-        Config::set('url_domain_deploy', false);
-        Config::set('url_common_param', false);
-        Url::root('/index.php');
-        Route::get('blog/:id', 'index/blog/read');
-        Config::set('url_html_suffix', 'shtml');
-        $this->assertEquals('/index.php/blog/10/name/thinkphp.shtml', Url::build('index/blog/read?id=10&name=thinkphp'));
-
-    }
-}

+ 0 - 200
thinkphp/tests/thinkphp/library/think/validateTest.php

@@ -1,200 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * Validate类测试
- */
-
-namespace tests\thinkphp\library\think;
-
-use think\File;
-use think\Validate;
-
-class validateTest extends \PHPUnit_Framework_TestCase
-{
-
-    public function testCheck()
-    {
-        $rule = [
-            'name'  => 'require|max:25',
-            'age'   => 'number|between:1,120',
-            'email' => 'email',
-        ];
-        $msg = [
-            'name.require' => '名称必须',
-            'name.max'     => '名称最多不能超过25个字符',
-            'age.number'   => '年龄必须是数字',
-            'age.between'  => '年龄只能在1-120之间',
-            'email'        => '邮箱格式错误',
-        ];
-        $data = [
-            'name'  => 'thinkphp',
-            'age'   => 10,
-            'email' => 'thinkphp@qq.com',
-        ];
-        $validate = new Validate($rule, $msg);
-        $result   = $validate->check($data);
-        $this->assertEquals(true, $result);
-    }
-
-    public function testRule()
-    {
-        $rule = [
-            'name'       => 'require|method:get|alphaNum|max:25|expire:2016-1-1,2026-1-1',
-            'account'    => 'requireIf:name,thinkphp|alphaDash|min:4|length:4,30',
-            'age'        => 'number|between:1,120',
-            'email'      => 'requireWith:name|email',
-            'host'       => 'activeUrl|activeUrl:A',
-            'url'        => 'url',
-            'ip'         => 'ip|ip:ipv4',
-            'score'      => 'float|gt:60|notBetween:90,100|notIn:70,80|lt:100|elt:100|egt:60',
-            'status'     => 'integer|in:0,1,2',
-            'begin_time' => 'after:2016-3-18|beforeWith:end_time',
-            'end_time'   => 'before:2016-10-01|afterWith:begin_time',
-            'info'       => 'require|array|length:4|max:5|min:2',
-            'info.name'  => 'require|length:8|alpha|same:thinkphp',
-            'value'      => 'same:100|different:status',
-            'bool'       => 'boolean',
-            'title'      => 'chsAlpha',
-            'city'       => 'chs',
-            'nickname'   => 'chsDash',
-            'aliasname'  => 'chsAlphaNum',
-            'file'       => 'file|fileSize:20480',
-            'image'      => 'image|fileMime:image/png|image:80,80,png',
-            'test'       => 'test',
-        ];
-        $data = [
-            'name'       => 'thinkphp',
-            'account'    => 'liuchen',
-            'age'        => 10,
-            'email'      => 'thinkphp@qq.com',
-            'host'       => 'thinkphp.cn',
-            'url'        => 'http://thinkphp.cn/topic',
-            'ip'         => '114.34.54.5',
-            'score'      => '89.15',
-            'status'     => 1,
-            'begin_time' => '2016-3-20',
-            'end_time'   => '2016-5-1',
-            'info'       => [1, 2, 3, 'name' => 'thinkphp'],
-            'zip'        => '200000',
-            'date'       => '16-3-8',
-            'ok'         => 'yes',
-            'value'      => 100,
-            'bool'       => true,
-            'title'      => '流年ThinkPHP',
-            'city'       => '上海',
-            'nickname'   => '流年ThinkPHP_2016',
-            'aliasname'  => '流年Think2016',
-            'file'       => new File(THINK_PATH . 'base.php'),
-            'image'      => new File(THINK_PATH . 'logo.png'),
-            'test'       => 'test',
-        ];
-        $validate = new Validate($rule);
-        $validate->extend('test', function ($value) {return 'test' == $value ? true : false;});
-        $validate->rule('zip', '/^\d{6}$/');
-        $validate->rule([
-            'ok'   => 'require|accepted',
-            'date' => 'date|dateFormat:y-m-d',
-        ]);
-        $result = $validate->batch()->check($data);
-        $this->assertEquals(true, $result);
-    }
-
-    public function testMsg()
-    {
-        $validate = new Validate();
-        $validate->message('name.require', '名称必须');
-        $validate->message([
-            'name.require' => '名称必须',
-            'name.max'     => '名称最多不能超过25个字符',
-            'age.number'   => '年龄必须是数字',
-            'age.between'  => '年龄只能在1-120之间',
-            'email'        => '邮箱格式错误',
-        ]);
-    }
-
-    public function testMake()
-    {
-        $rule = [
-            'name'  => 'require|max:25',
-            'age'   => 'number|between:1,120',
-            'email' => 'email',
-        ];
-        $msg = [
-            'name.require' => '名称必须',
-            'name.max'     => '名称最多不能超过25个字符',
-            'age.number'   => '年龄必须是数字',
-            'age.between'  => '年龄只能在1-120之间',
-            'email'        => '邮箱格式错误',
-        ];
-        $validate = Validate::make($rule, $msg);
-    }
-
-    public function testExtend()
-    {
-        $validate = new Validate(['name' => 'check:1']);
-        $validate->extend('check', function ($value, $rule) {return $rule == $value ? true : false;});
-        $validate->extend(['check' => function ($value, $rule) {return $rule == $value ? true : false;}]);
-        $data   = ['name' => 1];
-        $result = $validate->check($data);
-        $this->assertEquals(true, $result);
-    }
-
-    public function testScene()
-    {
-        $rule = [
-            'name'  => 'require|max:25',
-            'age'   => 'number|between:1,120',
-            'email' => 'email',
-        ];
-        $msg = [
-            'name.require' => '名称必须',
-            'name.max'     => '名称最多不能超过25个字符',
-            'age.number'   => '年龄必须是数字',
-            'age.between'  => '年龄只能在1-120之间',
-            'email'        => '邮箱格式错误',
-        ];
-        $data = [
-            'name'  => 'thinkphp',
-            'age'   => 10,
-            'email' => 'thinkphp@qq.com',
-        ];
-        $validate = new Validate($rule);
-        $validate->scene(['edit' => ['name', 'age']]);
-        $validate->scene('edit', ['name', 'age']);
-        $validate->scene('edit');
-        $result = $validate->check($data);
-        $this->assertEquals(true, $result);
-    }
-
-    public function testSetTypeMsg()
-    {
-        $rule = [
-            'name|名称' => 'require|max:25',
-            'age'     => 'number|between:1,120',
-            'email'   => 'email',
-            ['sex', 'in:1,2', '性别错误'],
-        ];
-        $data = [
-            'name'  => '',
-            'age'   => 10,
-            'email' => 'thinkphp@qq.com',
-            'sex'   => '3',
-        ];
-        $validate = new Validate($rule);
-        $validate->setTypeMsg('require', ':attribute必须');
-        $validate->setTypeMsg(['require' => ':attribute必须']);
-        $result = $validate->batch()->check($data);
-        $this->assertFalse($result);
-        $this->assertEquals(['name' => '名称必须', 'sex' => '性别错误'], $validate->getError());
-    }
-
-}

+ 0 - 2
thinkphp/tests/thinkphp/library/think/view/driver/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 0 - 14
thinkphp/tests/thinkphp/library/think/view/theme/index/template.html

@@ -1,14 +0,0 @@
-<!doctype html>
-<html lang="en">
- <head>
-  <meta charset="UTF-8">
-  <meta name="Generator" content="EditPlus®">
-  <meta name="Author" content="">
-  <meta name="Keywords" content="">
-  <meta name="Description" content="">
-  <title>Document</title>
- </head>
- <body>
-  
- </body>
-</html>

+ 0 - 76
thinkphp/tests/thinkphp/library/think/viewTest.php

@@ -1,76 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-/**
- * view测试
- * @author    mahuan <mahuan@d1web.top>
- */
-
-namespace tests\thinkphp\library\think;
-
-class viewTest extends \PHPUnit_Framework_TestCase
-{
-
-    /**
-     * 句柄测试
-     * @return  mixed
-     * @access public
-     */
-    public function testGetInstance()
-    {
-        \think\Cookie::get('a');
-        $view_instance = \think\View::instance();
-        $this->assertInstanceOf('\think\view', $view_instance, 'instance方法返回错误');
-    }
-
-    /**
-     * 测试变量赋值
-     * @return  mixed
-     * @access public
-     */
-    public function testAssign()
-    {
-        $view_instance      = \think\View::instance();
-        $view_instance->key = 'value';
-        $this->assertTrue(isset($view_instance->key));
-        $this->assertEquals('value', $view_instance->key);
-        $data = $view_instance->assign(array('key' => 'value'));
-        $data = $view_instance->assign('key2', 'value2');
-        //测试私有属性
-        $expect_data = array('key' => 'value', 'key2' => 'value2');
-        $this->assertAttributeEquals($expect_data, 'data', $view_instance);
-    }
-
-    /**
-     *  测试引擎设置
-     * @return  mixed
-     * @access public
-     */
-    public function testEngine()
-    {
-        $view_instance = \think\View::instance();
-        $data          = $view_instance->engine('php');
-        $data          = $view_instance->engine(['type' => 'php', 'view_path' => '', 'view_suffix' => '.php', 'view_depr' => DS]);
-        $php_engine    = new \think\view\driver\Php(['view_path' => '', 'view_suffix' => '.php', 'view_depr' => DS]);
-        $this->assertAttributeEquals($php_engine, 'engine', $view_instance);
-        //测试模板引擎驱动
-        $data         = $view_instance->engine(['type' => 'think', 'view_path' => '', 'view_suffix' => '.html', 'view_depr' => DS]);
-        $think_engine = new \think\view\driver\Think(['view_path' => '', 'view_suffix' => '.html', 'view_depr' => DS]);
-        $this->assertAttributeEquals($think_engine, 'engine', $view_instance);
-    }
-
-    public function testReplace()
-    {
-        $view_instance = \think\View::instance();
-        $view_instance->replace('string', 'replace')->display('string');
-    }
-
-}

+ 0 - 339
thinkphp/tests/thinkphp/library/traits/controller/jumpTest.php

@@ -1,339 +0,0 @@
-<?php
-namespace tests\thinkphp\library\traits\controller;
-
-use think\Config;
-use think\Request;
-use think\Response;
-use think\response\Redirect;
-use think\View;
-use traits\controller\Jump;
-
-class jumpTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var testClassWithJump
-     */
-    protected $testClass;
-
-    /**
-     * @var Request
-     */
-    protected $request;
-
-    /**
-     * @var mixed
-     */
-    protected $originServerData;
-
-    public function setUp()
-    {
-        $this->testClass = new testClassWithJump();
-        $this->request   = Request::create('');
-
-        $this->originServerData = Request::instance()->server();
-    }
-
-    public function tearDown()
-    {
-        Request::instance()->server($this->originServerData);
-    }
-
-    /**
-     * @dataProvider provideTestSuccess
-     */
-    public function testSuccess($arguments, $expected, array $extra)
-    {
-        if (isset($extra['server'])) {
-            $this->request->server($extra['server']);
-        }
-
-        $mock = $this->getMockBuilder(get_class($this->testClass))->setMethods(['getResponseType'])->getMock();
-        $mock->expects($this->any())->method('getResponseType')->willReturn($extra['return']);
-
-        try {
-            call_user_func_array([$mock, 'success'], $arguments);
-            $this->setExpectedException('\think\exception\HttpResponseException');
-        } catch (\Exception $e) {
-            $this->assertInstanceOf('\think\exception\HttpResponseException', $e);
-
-            /** @var Response $response */
-            $response = $e->getResponse();
-
-            $this->assertInstanceOf('\Think\Response', $response);
-            $this->assertEquals($expected['header'], $response->getHeader());
-            $this->assertEquals($expected['data'], $response->getData());
-        }
-    }
-
-    /**
-     * @dataProvider provideTestError
-     */
-    public function testError($arguments, $expected, array $extra)
-    {
-        if (isset($extra['server'])) {
-            $this->request->server($extra['server']);
-        }
-
-        $mock = $this->getMockBuilder(get_class($this->testClass))->setMethods(['getResponseType'])->getMock();
-        $mock->expects($this->any())->method('getResponseType')->willReturn($extra['return']);
-
-        try {
-            call_user_func_array([$mock, 'error'], $arguments);
-            $this->setExpectedException('\think\exception\HttpResponseException');
-        } catch (\Exception $e) {
-            $this->assertInstanceOf('\think\exception\HttpResponseException', $e);
-
-            /** @var Response $response */
-            $response = $e->getResponse();
-
-            $this->assertInstanceOf('\Think\Response', $response);
-            $this->assertEquals($expected['header'], $response->getHeader());
-            $this->assertEquals($expected['data'], $response->getData());
-        }
-    }
-
-    /**
-     * @dataProvider provideTestResult
-     */
-    public function testResult($arguments, $expected, array $extra)
-    {
-        if (isset($extra['server'])) {
-            $this->request->server($extra['server']);
-        }
-
-        $mock = $this->getMockBuilder(get_class($this->testClass))->setMethods(['getResponseType'])->getMock();
-        $mock->expects($this->any())->method('getResponseType')->willReturn($extra['return']);
-
-        try {
-            call_user_func_array([$mock, 'result'], $arguments);
-            $this->setExpectedException('\think\exception\HttpResponseException');
-        } catch (\Exception $e) {
-            $this->assertInstanceOf('\think\exception\HttpResponseException', $e);
-
-            /** @var Response $response */
-            $response = $e->getResponse();
-
-            $this->assertInstanceOf('\Think\Response', $response);
-            $this->assertEquals($expected['header'], $response->getHeader());
-            $this->assertEquals($expected['data'], $response->getData());
-        }
-    }
-
-    /**
-     * @dataProvider provideTestRedirect
-     */
-    public function testRedirect($arguments, $expected)
-    {
-        try {
-            call_user_func_array([$this->testClass, 'redirect'], $arguments);
-            $this->setExpectedException('\think\exception\HttpResponseException');
-        } catch (\Exception $e) {
-            $this->assertInstanceOf('\think\exception\HttpResponseException', $e);
-
-            /** @var Redirect $response */
-            $response = $e->getResponse();
-
-            $this->assertInstanceOf('\think\response\Redirect', $response);
-            $this->assertEquals($expected['url'], $response->getTargetUrl());
-            $this->assertEquals($expected['code'], $response->getCode());
-        }
-    }
-
-    public function testGetResponseType()
-    {
-        Request::instance()->server(['HTTP_X_REQUESTED_WITH' => null]);
-        $this->assertEquals('html', $this->testClass->getResponseType());
-
-        Request::instance()->server(['HTTP_X_REQUESTED_WITH' => true]);
-        $this->assertEquals('html', $this->testClass->getResponseType());
-
-        Request::instance()->server(['HTTP_X_REQUESTED_WITH' => 'xmlhttprequest']);
-        $this->assertEquals('json', $this->testClass->getResponseType());
-    }
-
-    public function provideTestSuccess()
-    {
-        $provideData = [];
-
-        $arguments = ['', null, '', 3, []];
-        $expected  = [
-            'header' => [
-                'Content-Type' => 'text/html; charset=utf-8'
-            ],
-            'data'   => View::instance(Config::get('template'), Config::get('view_replace_str'))
-                ->fetch(Config::get('dispatch_error_tmpl'), [
-                    'code' => 1,
-                    'msg'  => '',
-                    'data' => '',
-                    'url'  => '/index.php/',
-                    'wait' => 3,
-                ])
-        ];
-        $provideData[] = [$arguments, $expected, ['server' => ['HTTP_REFERER' => null], 'return' => 'html']];
-
-        $arguments = ['thinkphp', null, ['foo'], 4, ['Power-By' => 'thinkphp', 'Content-Type' => 'text/html; charset=gbk']];
-        $expected  = [
-            'header' => [
-                'Content-Type' => 'text/html; charset=gbk',
-                'Power-By' => 'thinkphp'
-            ],
-            'data'   => View::instance(Config::get('template'), Config::get('view_replace_str'))
-                ->fetch(Config::get('dispatch_error_tmpl'), [
-                    'code' => 1,
-                    'msg'  => 'thinkphp',
-                    'data' => ['foo'],
-                    'url'  => 'http://www.thinkphp.cn',
-                    'wait' => 4,
-                ])
-        ];
-        $provideData[] = [$arguments, $expected, ['server' => ['HTTP_REFERER' => 'http://www.thinkphp.cn'], 'return' => 'html']];
-
-        $arguments = ['thinkphp', 'index', ['foo'], 5, []];
-        $expected  = [
-            'header' => [
-                'Content-Type' => 'application/json; charset=utf-8'
-            ],
-            'data'   => [
-                'code' => 1,
-                'msg'  => 'thinkphp',
-                'data' => ['foo'],
-                'url'  => '/index.php/index.html',
-                'wait' => 5,
-                ]
-        ];
-        $provideData[] = [$arguments, $expected, ['server' => ['HTTP_REFERER' => null], 'return' => 'json']];
-
-        return $provideData;
-    }
-
-    public function provideTestError()
-    {
-        $provideData = [];
-
-        $arguments = ['', null, '', 3, []];
-        $expected  = [
-            'header' => [
-                'Content-Type' => 'text/html; charset=utf-8'
-            ],
-            'data'   => View::instance(Config::get('template'), Config::get('view_replace_str'))
-                ->fetch(Config::get('dispatch_error_tmpl'), [
-                    'code' => 0,
-                    'msg'  => '',
-                    'data' => '',
-                    'url'  => 'javascript:history.back(-1);',
-                    'wait' => 3,
-                ])
-        ];
-        $provideData[] = [$arguments, $expected, ['return' => 'html']];
-
-        $arguments = ['thinkphp', 'http://www.thinkphp.cn', ['foo'], 4, ['Power-By' => 'thinkphp', 'Content-Type' => 'text/html; charset=gbk']];
-        $expected  = [
-            'header' => [
-                'Content-Type' => 'text/html; charset=gbk',
-                'Power-By' => 'thinkphp'
-            ],
-            'data'   => View::instance(Config::get('template'), Config::get('view_replace_str'))
-                ->fetch(Config::get('dispatch_error_tmpl'), [
-                    'code' => 0,
-                    'msg'  => 'thinkphp',
-                    'data' => ['foo'],
-                    'url'  => 'http://www.thinkphp.cn',
-                    'wait' => 4,
-                ])
-        ];
-        $provideData[] = [$arguments, $expected, ['return' => 'html']];
-
-        $arguments = ['thinkphp', '', ['foo'], 5, []];
-        $expected  = [
-            'header' => [
-                'Content-Type' => 'application/json; charset=utf-8'
-            ],
-            'data'   => [
-                'code' => 0,
-                'msg'  => 'thinkphp',
-                'data' => ['foo'],
-                'url'  => '',
-                'wait' => 5,
-            ]
-        ];
-        $provideData[] = [$arguments, $expected, ['return' => 'json']];
-
-        return $provideData;
-    }
-
-    public function provideTestResult()
-    {
-        $provideData = [];
-
-        $arguments = [null, 0, '', '', []];
-        $expected  = [
-            'header' => [
-                'Content-Type' => 'text/html; charset=utf-8'
-            ],
-            'data' => [
-                    'code' => 0,
-                    'msg'  => '',
-                    'time' => Request::create('')->server('REQUEST_TIME'),
-                    'data' => null,
-                ]
-        ];
-        $provideData[] = [$arguments, $expected, ['return' => 'html']];
-
-        $arguments = [['foo'], 200, 'thinkphp', 'json', ['Power-By' => 'thinkphp']];
-        $expected  = [
-            'header' => [
-                'Power-By' => 'thinkphp',
-                'Content-Type' => 'application/json; charset=utf-8'
-            ],
-            'data'   => [
-                'code' => 200,
-                'msg'  => 'thinkphp',
-                'time' => 1000,
-                'data' => ['foo'],
-            ]
-        ];
-
-        $provideData[] = [$arguments, $expected, ['server' => ['REQUEST_TIME' => 1000], 'return' => 'json']];
-
-        return $provideData;
-    }
-
-    public function provideTestRedirect()
-    {
-        $provideData = [];
-
-        $arguments = ['', [], 302, []];
-        $expected  = [
-            'code'=> 302,
-            'url' => '/index.php/'
-        ];
-        $provideData[] = [$arguments, $expected, []];
-
-        $arguments = ['index', 302, null, []];
-        $expected  = [
-            'code'=> 302,
-            'url' => '/index.php/index.html'
-        ];
-        $provideData[] = [$arguments, $expected, []];
-
-        $arguments = ['http://www.thinkphp.cn', 301, 302, []];
-        $expected  = [
-            'code'=> 301,
-            'url' => 'http://www.thinkphp.cn'
-        ];
-        $provideData[] = [$arguments, $expected, []];
-
-        return $provideData;
-    }
-}
-
-class testClassWithJump
-{
-    use Jump {
-        success as public;
-        error as public;
-        result as public;
-        redirect as public;
-        getResponseType as public;
-    }
-}

+ 0 - 179
thinkphp/tests/thinkphp/library/traits/model/softDeleteTest.php

@@ -1,179 +0,0 @@
-<?php
-namespace tests\thinkphp\library\traits\model;
-
-use think\Db;
-use think\Model;
-use traits\model\SoftDelete;
-
-class softDeleteTest extends \PHPUnit_Framework_TestCase
-{
-    const TEST_TIME = 10000;
-
-    public function setUp()
-    {
-        $config = (new testClassWithSoftDelete())->connection;
-
-        $sql[] = <<<SQL
-DROP TABLE IF EXISTS `tp_soft_delete`;
-SQL;
-
-        $sql[] = <<<SQL
-CREATE TABLE `tp_soft_delete` (
-  `id` int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-  `name` char(40) NOT NULL DEFAULT '' COMMENT '用户名',
-  `delete_time` int(10) DEFAULT NULL COMMENT '软删除时间'
-) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='ThinkPHP SoftDelete Test';
-SQL;
-
-        $time = self::TEST_TIME;
-        $sql[] = "INSERT INTO tp_soft_delete (`id`, `name`, `delete_time`) VALUES (1, 'valid data1', null)";
-        $sql[] = "INSERT INTO tp_soft_delete (`id`, `name`, `delete_time`) VALUES (2, 'invalid data2', {$time})";
-        $sql[] = "INSERT INTO tp_soft_delete (`id`, `name`, `delete_time`) VALUES (3, 'invalid data3', {$time})";
-        $sql[] = "INSERT INTO tp_soft_delete (`id`, `name`, `delete_time`) VALUES (4, 'valid data4', null)";
-        $sql[] = "INSERT INTO tp_soft_delete (`id`, `name`, `delete_time`) VALUES (5, 'valid data5', null)";
-
-        foreach ($sql as $one) {
-            Db::connect($config)->execute($one);
-        }
-    }
-
-    public function testTrashed()
-    {
-        /** @var testClassWithSoftDelete[] $selections */
-        $selections = testClassWithSoftDelete::withTrashed()->select();
-
-        $this->assertFalse($selections[0]->trashed());
-        $this->assertTrue($selections[1]->trashed());
-        $this->assertTrue($selections[2]->trashed());
-    }
-
-    public function testDefaultTrashed()
-    {
-        $this->assertCount(3, testClassWithSoftDelete::all());
-    }
-
-    public function testWithTrashed()
-    {
-        $this->assertCount(5, testClassWithSoftDelete::withTrashed()->select());
-    }
-
-    public function testOnlyTrashed()
-    {
-        $this->assertCount(2, testClassWithSoftDelete::onlyTrashed()->select());
-    }
-
-    public function testSoftDelete()
-    {
-        $this->assertEquals(1, testClassWithSoftDelete::get(1)->delete());
-        $this->assertNotNull(testClassWithSoftDelete::withTrashed()->find(1)->getData('delete_time'));
-    }
-
-    public function testForceDelete()
-    {
-        $this->assertEquals(1, testClassWithSoftDelete::get(1)->delete(true));
-        $this->assertNull(testClassWithSoftDelete::get(1));
-    }
-
-    public function testSoftDestroy()
-    {
-        $this->assertEquals(5, testClassWithSoftDelete::destroy([1, 2, 3, 4, 5, 6]));
-        $this->assertNotNull(testClassWithSoftDelete::withTrashed()->find(2)->getData('delete_time'));
-        $this->assertNotEquals(self::TEST_TIME, testClassWithSoftDelete::withTrashed()->find(2)->getData('delete_time'));
-        $this->assertNotEquals(self::TEST_TIME, testClassWithSoftDelete::withTrashed()->find(3)->getData('delete_time'));
-        $this->assertNotNull(testClassWithSoftDelete::withTrashed()->find(4)->getData('delete_time'));
-        $this->assertNotNull(testClassWithSoftDelete::withTrashed()->find(5)->getData('delete_time'));
-    }
-
-    public function testForceDestroy()
-    {
-        $this->assertEquals(5, testClassWithSoftDelete::destroy([1, 2, 3, 4, 5, 6], true));
-        $this->assertNull(testClassWithSoftDelete::withTrashed()->find(1));
-        $this->assertNull(testClassWithSoftDelete::withTrashed()->find(2));
-        $this->assertNull(testClassWithSoftDelete::withTrashed()->find(3));
-        $this->assertNull(testClassWithSoftDelete::withTrashed()->find(4));
-        $this->assertNull(testClassWithSoftDelete::withTrashed()->find(5));
-    }
-
-    public function testRestore()
-    {
-        /** @var testClassWithSoftDelete[] $selections */
-        $selections = testClassWithSoftDelete::withTrashed()->select();
-
-        $this->assertEquals(0, $selections[0]->restore());
-        $this->assertEquals(1, $selections[1]->restore());
-        $this->assertEquals(1, $selections[2]->restore());
-        $this->assertEquals(0, $selections[3]->restore());
-        $this->assertEquals(0, $selections[4]->restore());
-
-        $this->assertNull(testClassWithSoftDelete::withTrashed()->find(1)->getData('delete_time'));
-        $this->assertNull(testClassWithSoftDelete::withTrashed()->find(2)->getData('delete_time'));
-    }
-
-    public function testGetDeleteTimeField()
-    {
-        $testClass = new testClassWithSoftDelete();
-
-        $this->assertEquals('delete_time', $testClass->getDeleteTimeField());
-
-        $testClass->deleteTime = 'create_time';
-        $this->assertEquals('create_time', $testClass->getDeleteTimeField());
-
-        $testClass->deleteTime = 'test.create_time';
-        $this->assertEquals('create_time', $testClass->getDeleteTimeField());
-
-        $testClass->deleteTime = 'create_time';
-        $this->assertEquals('__TABLE__.create_time', $testClass->getDeleteTimeField(true));
-    }
-}
-
-class testClassWithSoftDelete extends Model
-{
-    public $table = 'tp_soft_delete';
-
-    public $deleteTime = 'delete_time';
-
-    public $connection = [
-        // 数据库类型
-        'type'           => 'mysql',
-        // 服务器地址
-        'hostname'       => '127.0.0.1',
-        // 数据库名
-        'database'       => 'test',
-        // 用户名
-        'username'       => 'root',
-        // 密码
-        'password'       => '',
-        // 端口
-        'hostport'       => '',
-        // 连接dsn
-        'dsn'            => '',
-        // 数据库连接参数
-        'params'         => [],
-        // 数据库编码默认采用utf8
-        'charset'        => 'utf8',
-        // 数据库表前缀
-        'prefix'         => '',
-        // 数据库调试模式
-        'debug'          => true,
-        // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
-        'deploy'         => 0,
-        // 数据库读写是否分离 主从式有效
-        'rw_separate'    => false,
-        // 读写分离后 主服务器数量
-        'master_num'     => 1,
-        // 指定从服务器序号
-        'slave_no'       => '',
-        // 是否严格检查字段是否存在
-        'fields_strict'  => true,
-        // 数据集返回类型 array 数组 collection Collection对象
-        'resultset_type' => 'array',
-        // 是否自动写入时间戳字段
-        'auto_timestamp' => false,
-        // 是否需要进行SQL性能分析
-        'sql_explain'    => false,
-    ];
-
-    use SoftDelete {
-        getDeleteTimeField as public;
-    }
-}

+ 0 - 60
thinkphp/tests/thinkphp/library/traits/think/instanceTest.php

@@ -1,60 +0,0 @@
-<?php
-namespace tests\thinkphp\library\traits\think;
-
-use traits\think\Instance;
-
-class instanceTest extends \PHPUnit_Framework_TestCase
-{
-    public function testInstance()
-    {
-        $father = InstanceTestFather::instance();
-        $this->assertInstanceOf('\tests\thinkphp\library\traits\think\InstanceTestFather', $father);
-        $this->assertEquals([], $father->options);
-
-        $son = InstanceTestFather::instance(['son']);
-        $this->assertSame($father, $son);
-    }
-
-    public function testCallStatic()
-    {
-        $father = InstanceTestFather::instance();
-        $this->assertEquals([], $father->options);
-
-        $this->assertEquals($father::__protectedStaticFunc(['thinkphp']), 'protectedStaticFunc["thinkphp"]');
-
-        try {
-            $father::_protectedStaticFunc();
-            $this->setExpectedException('\think\Exception');
-        } catch (\Exception $e) {
-            $this->assertInstanceOf('\think\Exception', $e);
-        }
-    }
-
-    protected function tearDown()
-    {
-        call_user_func(\Closure::bind(function () {
-            InstanceTestFather::$instance = null;
-        }, null, '\tests\thinkphp\library\traits\think\InstanceTestFather'));
-    }
-}
-
-class InstanceTestFather
-{
-    use Instance;
-
-    public $options = null;
-
-    public function __construct($options)
-    {
-        $this->options = $options;
-    }
-
-    protected static function _protectedStaticFunc($params)
-    {
-        return 'protectedStaticFunc' . json_encode($params);
-    }
-}
-
-class InstanceTestSon extends InstanceTestFather
-{
-}

+ 0 - 18
vendor/autoload.php

@@ -2,24 +2,6 @@
 
 // autoload.php @generated by Composer
 
-if (PHP_VERSION_ID < 50600) {
-    if (!headers_sent()) {
-        header('HTTP/1.1 500 Internal Server Error');
-    }
-    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
-    if (!ini_get('display_errors')) {
-        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
-            fwrite(STDERR, $err);
-        } elseif (!headers_sent()) {
-            echo $err;
-        }
-    }
-    trigger_error(
-        $err,
-        E_USER_ERROR
-    );
-}
-
 require_once __DIR__ . '/composer/autoload_real.php';
 
 return ComposerAutoloaderInit73f9e72fede2c36621e52f7b610bbb65::getLoader();

+ 7 - 9
vendor/composer/InstalledVersions.php

@@ -21,14 +21,12 @@ use Composer\Semver\VersionParser;
  * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
  *
  * To require its presence, you can require `composer-runtime-api ^2.0`
- *
- * @final
  */
 class InstalledVersions
 {
     /**
      * @var mixed[]|null
-     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
+     * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
      */
     private static $installed;
 
@@ -39,7 +37,7 @@ class InstalledVersions
 
     /**
      * @var array[]
-     * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
+     * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
      */
     private static $installedByVendor = array();
 
@@ -243,7 +241,7 @@ class InstalledVersions
 
     /**
      * @return array
-     * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
+     * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
      */
     public static function getRootPackage()
     {
@@ -257,7 +255,7 @@ class InstalledVersions
      *
      * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
      * @return array[]
-     * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
+     * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
      */
     public static function getRawData()
     {
@@ -280,7 +278,7 @@ class InstalledVersions
      * Returns the raw data of all installed.php which are currently loaded for custom implementations
      *
      * @return array[]
-     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
+     * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
      */
     public static function getAllRawData()
     {
@@ -303,7 +301,7 @@ class InstalledVersions
      * @param  array[] $data A vendor/composer/installed.php data set
      * @return void
      *
-     * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
+     * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
      */
     public static function reload($data)
     {
@@ -313,7 +311,7 @@ class InstalledVersions
 
     /**
      * @return array[]
-     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
+     * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
      */
     private static function getInstalled()
     {

+ 2 - 2
vendor/composer/autoload_classmap.php

@@ -2,7 +2,7 @@
 
 // autoload_classmap.php @generated by Composer
 
-$vendorDir = dirname(__DIR__);
+$vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(
@@ -10,7 +10,7 @@ return array(
     'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
     'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
     'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
-    'Stringable' => $vendorDir . '/myclabs/php-enum/stubs/Stringable.php',
+    'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
     'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
     'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
 );

+ 1 - 1
vendor/composer/autoload_files.php

@@ -2,7 +2,7 @@
 
 // autoload_files.php @generated by Composer
 
-$vendorDir = dirname(__DIR__);
+$vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(

+ 1 - 1
vendor/composer/autoload_namespaces.php

@@ -2,7 +2,7 @@
 
 // autoload_namespaces.php @generated by Composer
 
-$vendorDir = dirname(__DIR__);
+$vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(

+ 4 - 3
vendor/composer/autoload_psr4.php

@@ -2,14 +2,14 @@
 
 // autoload_psr4.php @generated by Composer
 
-$vendorDir = dirname(__DIR__);
+$vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(
     'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'),
     'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
     'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'),
-    'think\\' => array($vendorDir . '/karsonzhang/fastadmin-addons/src', $vendorDir . '/topthink/think-queue/src', $baseDir . '/thinkphp/library/think'),
+    'think\\' => array($vendorDir . '/karsonzhang/fastadmin-addons/src', $baseDir . '/thinkphp/library/think', $vendorDir . '/topthink/think-queue/src'),
     'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
     'Tx\\' => array($vendorDir . '/txthinking/mailer/src'),
     'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
@@ -26,7 +26,7 @@ return array(
     'Symfony\\Bridge\\PsrHttpMessage\\' => array($vendorDir . '/symfony/psr-http-message-bridge'),
     'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
     'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
-    'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
+    'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
     'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
     'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
     'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
@@ -41,6 +41,7 @@ return array(
     'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
     'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
     'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
+    'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'),
     'EasyWeChat\\' => array($vendorDir . '/overtrue/wechat/src'),
     'EasyWeChatComposer\\' => array($vendorDir . '/easywechat-composer/easywechat-composer/src'),
     'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'),

+ 27 - 4
vendor/composer/autoload_real.php

@@ -25,15 +25,38 @@ class ComposerAutoloaderInit73f9e72fede2c36621e52f7b610bbb65
         require __DIR__ . '/platform_check.php';
 
         spl_autoload_register(array('ComposerAutoloaderInit73f9e72fede2c36621e52f7b610bbb65', 'loadClassLoader'), true, true);
-        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
+        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
         spl_autoload_unregister(array('ComposerAutoloaderInit73f9e72fede2c36621e52f7b610bbb65', 'loadClassLoader'));
 
-        require __DIR__ . '/autoload_static.php';
-        call_user_func(\Composer\Autoload\ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65::getInitializer($loader));
+        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
+        if ($useStaticLoader) {
+            require __DIR__ . '/autoload_static.php';
+
+            call_user_func(\Composer\Autoload\ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65::getInitializer($loader));
+        } else {
+            $map = require __DIR__ . '/autoload_namespaces.php';
+            foreach ($map as $namespace => $path) {
+                $loader->set($namespace, $path);
+            }
+
+            $map = require __DIR__ . '/autoload_psr4.php';
+            foreach ($map as $namespace => $path) {
+                $loader->setPsr4($namespace, $path);
+            }
+
+            $classMap = require __DIR__ . '/autoload_classmap.php';
+            if ($classMap) {
+                $loader->addClassMap($classMap);
+            }
+        }
 
         $loader->register(true);
 
-        $includeFiles = \Composer\Autoload\ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65::$files;
+        if ($useStaticLoader) {
+            $includeFiles = Composer\Autoload\ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65::$files;
+        } else {
+            $includeFiles = require __DIR__ . '/autoload_files.php';
+        }
         foreach ($includeFiles as $fileIdentifier => $file) {
             composerRequire73f9e72fede2c36621e52f7b610bbb65($fileIdentifier, $file);
         }

+ 13 - 5
vendor/composer/autoload_static.php

@@ -83,6 +83,10 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65
             'GuzzleHttp\\Promise\\' => 19,
             'GuzzleHttp\\' => 11,
         ),
+        'F' => 
+        array (
+            'Firebase\\JWT\\' => 13,
+        ),
         'E' => 
         array (
             'EasyWeChat\\' => 11,
@@ -110,8 +114,8 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65
         'think\\' => 
         array (
             0 => __DIR__ . '/..' . '/karsonzhang/fastadmin-addons/src',
-            1 => __DIR__ . '/..' . '/topthink/think-queue/src',
-            2 => __DIR__ . '/../..' . '/thinkphp/library/think',
+            1 => __DIR__ . '/../..' . '/thinkphp/library/think',
+            2 => __DIR__ . '/..' . '/topthink/think-queue/src',
         ),
         'ZipStream\\' => 
         array (
@@ -179,8 +183,8 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65
         ),
         'Psr\\Http\\Message\\' => 
         array (
-            0 => __DIR__ . '/..' . '/psr/http-factory/src',
-            1 => __DIR__ . '/..' . '/psr/http-message/src',
+            0 => __DIR__ . '/..' . '/psr/http-message/src',
+            1 => __DIR__ . '/..' . '/psr/http-factory/src',
         ),
         'Psr\\Http\\Client\\' => 
         array (
@@ -238,6 +242,10 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65
         array (
             0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
         ),
+        'Firebase\\JWT\\' => 
+        array (
+            0 => __DIR__ . '/..' . '/firebase/php-jwt/src',
+        ),
         'EasyWeChat\\' => 
         array (
             0 => __DIR__ . '/..' . '/overtrue/wechat/src',
@@ -274,7 +282,7 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65
         'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
         'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
         'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
-        'Stringable' => __DIR__ . '/..' . '/myclabs/php-enum/stubs/Stringable.php',
+        'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
         'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
         'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
     );

Файловите разлики са ограничени, защото са твърде много
+ 860 - 105
vendor/composer/installed.json


+ 83 - 76
vendor/composer/installed.php

@@ -1,193 +1,202 @@
 <?php return array(
     'root' => array(
-        'name' => 'karsonzhang/fastadmin',
-        'pretty_version' => '1.3.5.x-dev',
-        'version' => '1.3.5.9999999-dev',
-        'reference' => 'f8292a8813201872005173b7d2ec3ca556a25cfd',
+        'pretty_version' => '1.0.0+no-version-set',
+        'version' => '1.0.0.0',
         'type' => 'project',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
+        'reference' => NULL,
+        'name' => 'karsonzhang/fastadmin',
         'dev' => true,
     ),
     'versions' => array(
         'easywechat-composer/easywechat-composer' => array(
             'pretty_version' => '1.4.1',
             'version' => '1.4.1.0',
-            'reference' => '3fc6a7ab6d3853c0f4e2922539b56cc37ef361cd',
             'type' => 'composer-plugin',
             'install_path' => __DIR__ . '/../easywechat-composer/easywechat-composer',
             'aliases' => array(),
+            'reference' => '3fc6a7ab6d3853c0f4e2922539b56cc37ef361cd',
             'dev_requirement' => false,
         ),
         'ezyang/htmlpurifier' => array(
             'pretty_version' => 'v4.16.0',
             'version' => '4.16.0.0',
-            'reference' => '523407fb06eb9e5f3d59889b3978d5bfe94299c8',
             'type' => 'library',
             'install_path' => __DIR__ . '/../ezyang/htmlpurifier',
             'aliases' => array(),
+            'reference' => '523407fb06eb9e5f3d59889b3978d5bfe94299c8',
+            'dev_requirement' => false,
+        ),
+        'firebase/php-jwt' => array(
+            'pretty_version' => 'v6.4.0',
+            'version' => '6.4.0.0',
+            'type' => 'library',
+            'install_path' => __DIR__ . '/../firebase/php-jwt',
+            'aliases' => array(),
+            'reference' => '4dd1e007f22a927ac77da5a3fbb067b42d3bc224',
             'dev_requirement' => false,
         ),
         'guzzlehttp/guzzle' => array(
             'pretty_version' => '7.5.0',
             'version' => '7.5.0.0',
-            'reference' => 'b50a2a1251152e43f6a37f0fa053e730a67d25ba',
             'type' => 'library',
             'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
             'aliases' => array(),
+            'reference' => 'b50a2a1251152e43f6a37f0fa053e730a67d25ba',
             'dev_requirement' => false,
         ),
         'guzzlehttp/promises' => array(
             'pretty_version' => '1.5.2',
             'version' => '1.5.2.0',
-            'reference' => 'b94b2807d85443f9719887892882d0329d1e2598',
             'type' => 'library',
             'install_path' => __DIR__ . '/../guzzlehttp/promises',
             'aliases' => array(),
+            'reference' => 'b94b2807d85443f9719887892882d0329d1e2598',
             'dev_requirement' => false,
         ),
         'guzzlehttp/psr7' => array(
-            'pretty_version' => '2.4.3',
-            'version' => '2.4.3.0',
-            'reference' => '67c26b443f348a51926030c83481b85718457d3d',
+            'pretty_version' => '2.4.4',
+            'version' => '2.4.4.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../guzzlehttp/psr7',
             'aliases' => array(),
+            'reference' => '3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf',
             'dev_requirement' => false,
         ),
         'karsonzhang/fastadmin' => array(
-            'pretty_version' => '1.3.5.x-dev',
-            'version' => '1.3.5.9999999-dev',
-            'reference' => 'f8292a8813201872005173b7d2ec3ca556a25cfd',
+            'pretty_version' => '1.0.0+no-version-set',
+            'version' => '1.0.0.0',
             'type' => 'project',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),
+            'reference' => NULL,
             'dev_requirement' => false,
         ),
         'karsonzhang/fastadmin-addons' => array(
             'pretty_version' => '1.3.3',
             'version' => '1.3.3.0',
-            'reference' => 'f5bb4dabda55271b08371a8ae9355a205be48c56',
             'type' => 'library',
             'install_path' => __DIR__ . '/../karsonzhang/fastadmin-addons',
             'aliases' => array(),
+            'reference' => 'f5bb4dabda55271b08371a8ae9355a205be48c56',
             'dev_requirement' => false,
         ),
         'maennchen/zipstream-php' => array(
-            'pretty_version' => '2.2.6',
-            'version' => '2.2.6.0',
-            'reference' => '30ad6f93cf3efe4192bc7a4c9cad11ff8f4f237f',
+            'pretty_version' => '2.1.0',
+            'version' => '2.1.0.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../maennchen/zipstream-php',
             'aliases' => array(),
+            'reference' => 'c4c5803cc1f93df3d2448478ef79394a5981cc58',
             'dev_requirement' => false,
         ),
         'markbaker/complex' => array(
             'pretty_version' => '3.0.2',
             'version' => '3.0.2.0',
-            'reference' => '95c56caa1cf5c766ad6d65b6344b807c1e8405b9',
             'type' => 'library',
             'install_path' => __DIR__ . '/../markbaker/complex',
             'aliases' => array(),
+            'reference' => '95c56caa1cf5c766ad6d65b6344b807c1e8405b9',
             'dev_requirement' => false,
         ),
         'markbaker/matrix' => array(
             'pretty_version' => '3.0.1',
             'version' => '3.0.1.0',
-            'reference' => '728434227fe21be27ff6d86621a1b13107a2562c',
             'type' => 'library',
             'install_path' => __DIR__ . '/../markbaker/matrix',
             'aliases' => array(),
+            'reference' => '728434227fe21be27ff6d86621a1b13107a2562c',
             'dev_requirement' => false,
         ),
         'monolog/monolog' => array(
-            'pretty_version' => '2.8.0',
-            'version' => '2.8.0.0',
-            'reference' => '720488632c590286b88b80e62aa3d3d551ad4a50',
+            'pretty_version' => '2.9.1',
+            'version' => '2.9.1.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../monolog/monolog',
             'aliases' => array(),
+            'reference' => 'f259e2b15fb95494c83f52d3caad003bbf5ffaa1',
             'dev_requirement' => false,
         ),
         'myclabs/php-enum' => array(
-            'pretty_version' => '1.8.4',
-            'version' => '1.8.4.0',
-            'reference' => 'a867478eae49c9f59ece437ae7f9506bfaa27483',
+            'pretty_version' => '1.7.7',
+            'version' => '1.7.7.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../myclabs/php-enum',
             'aliases' => array(),
+            'reference' => 'd178027d1e679832db9f38248fcc7200647dc2b7',
             'dev_requirement' => false,
         ),
         'nelexa/zip' => array(
             'pretty_version' => '3.3.3',
             'version' => '3.3.3.0',
-            'reference' => '501b52f6fc393a599b44ff348a42740e1eaac7c6',
             'type' => 'library',
             'install_path' => __DIR__ . '/../nelexa/zip',
             'aliases' => array(),
+            'reference' => '501b52f6fc393a599b44ff348a42740e1eaac7c6',
             'dev_requirement' => false,
         ),
         'overtrue/pinyin' => array(
             'pretty_version' => '3.0.6',
             'version' => '3.0.6.0',
-            'reference' => '3b781d267197b74752daa32814d3a2cf5d140779',
             'type' => 'library',
             'install_path' => __DIR__ . '/../overtrue/pinyin',
             'aliases' => array(),
+            'reference' => '3b781d267197b74752daa32814d3a2cf5d140779',
             'dev_requirement' => false,
         ),
         'overtrue/socialite' => array(
             'pretty_version' => '2.0.24',
             'version' => '2.0.24.0',
-            'reference' => 'ee7e7b000ec7d64f2b8aba1f6a2eec5cdf3f8bec',
             'type' => 'library',
             'install_path' => __DIR__ . '/../overtrue/socialite',
             'aliases' => array(),
+            'reference' => 'ee7e7b000ec7d64f2b8aba1f6a2eec5cdf3f8bec',
             'dev_requirement' => false,
         ),
         'overtrue/wechat' => array(
-            'pretty_version' => '4.7.0',
-            'version' => '4.7.0.0',
-            'reference' => '4accb0627803ffb6e45d2988898a0293d2a48e68',
+            'pretty_version' => '4.8.0',
+            'version' => '4.8.0.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../overtrue/wechat',
             'aliases' => array(),
+            'reference' => '4accb0627803ffb6e45d2988898a0293d2a48e68',
             'dev_requirement' => false,
         ),
         'paragonie/random_compat' => array(
             'pretty_version' => 'v9.99.100',
             'version' => '9.99.100.0',
-            'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
             'type' => 'library',
             'install_path' => __DIR__ . '/../paragonie/random_compat',
             'aliases' => array(),
+            'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
             'dev_requirement' => false,
         ),
         'phpoffice/phpspreadsheet' => array(
             'pretty_version' => '1.19.0',
             'version' => '1.19.0.0',
-            'reference' => 'a9ab55bfae02eecffb3df669a2e19ba0e2f04bbf',
             'type' => 'library',
             'install_path' => __DIR__ . '/../phpoffice/phpspreadsheet',
             'aliases' => array(),
+            'reference' => 'a9ab55bfae02eecffb3df669a2e19ba0e2f04bbf',
             'dev_requirement' => false,
         ),
         'pimple/pimple' => array(
             'pretty_version' => 'v3.5.0',
             'version' => '3.5.0.0',
-            'reference' => 'a94b3a4db7fb774b3d78dad2315ddc07629e1bed',
             'type' => 'library',
             'install_path' => __DIR__ . '/../pimple/pimple',
             'aliases' => array(),
+            'reference' => 'a94b3a4db7fb774b3d78dad2315ddc07629e1bed',
             'dev_requirement' => false,
         ),
         'psr/cache' => array(
             'pretty_version' => '1.0.1',
             'version' => '1.0.1.0',
-            'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
             'type' => 'library',
             'install_path' => __DIR__ . '/../psr/cache',
             'aliases' => array(),
+            'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
             'dev_requirement' => false,
         ),
         'psr/cache-implementation' => array(
@@ -197,21 +206,21 @@
             ),
         ),
         'psr/container' => array(
-            'pretty_version' => '2.0.2',
-            'version' => '2.0.2.0',
-            'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963',
+            'pretty_version' => '2.0.1',
+            'version' => '2.0.1.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../psr/container',
             'aliases' => array(),
+            'reference' => '2ae37329ee82f91efadc282cc2d527fd6065a5ef',
             'dev_requirement' => false,
         ),
         'psr/event-dispatcher' => array(
             'pretty_version' => '1.0.0',
             'version' => '1.0.0.0',
-            'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../psr/event-dispatcher',
             'aliases' => array(),
+            'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
             'dev_requirement' => false,
         ),
         'psr/event-dispatcher-implementation' => array(
@@ -223,10 +232,10 @@
         'psr/http-client' => array(
             'pretty_version' => '1.0.1',
             'version' => '1.0.1.0',
-            'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
             'type' => 'library',
             'install_path' => __DIR__ . '/../psr/http-client',
             'aliases' => array(),
+            'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
             'dev_requirement' => false,
         ),
         'psr/http-client-implementation' => array(
@@ -238,10 +247,10 @@
         'psr/http-factory' => array(
             'pretty_version' => '1.0.1',
             'version' => '1.0.1.0',
-            'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be',
             'type' => 'library',
             'install_path' => __DIR__ . '/../psr/http-factory',
             'aliases' => array(),
+            'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be',
             'dev_requirement' => false,
         ),
         'psr/http-factory-implementation' => array(
@@ -253,10 +262,10 @@
         'psr/http-message' => array(
             'pretty_version' => '1.0.1',
             'version' => '1.0.1.0',
-            'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
             'type' => 'library',
             'install_path' => __DIR__ . '/../psr/http-message',
             'aliases' => array(),
+            'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
             'dev_requirement' => false,
         ),
         'psr/http-message-implementation' => array(
@@ -268,10 +277,10 @@
         'psr/log' => array(
             'pretty_version' => '1.1.4',
             'version' => '1.1.4.0',
-            'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
             'type' => 'library',
             'install_path' => __DIR__ . '/../psr/log',
             'aliases' => array(),
+            'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
             'dev_requirement' => false,
         ),
         'psr/log-implementation' => array(
@@ -283,10 +292,10 @@
         'psr/simple-cache' => array(
             'pretty_version' => '1.0.1',
             'version' => '1.0.1.0',
-            'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
             'type' => 'library',
             'install_path' => __DIR__ . '/../psr/simple-cache',
             'aliases' => array(),
+            'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
             'dev_requirement' => false,
         ),
         'psr/simple-cache-implementation' => array(
@@ -298,28 +307,28 @@
         'ralouphie/getallheaders' => array(
             'pretty_version' => '3.0.3',
             'version' => '3.0.3.0',
-            'reference' => '120b605dfeb996808c31b6477290a714d356e822',
             'type' => 'library',
             'install_path' => __DIR__ . '/../ralouphie/getallheaders',
             'aliases' => array(),
+            'reference' => '120b605dfeb996808c31b6477290a714d356e822',
             'dev_requirement' => false,
         ),
         'symfony/cache' => array(
-            'pretty_version' => 'v5.4.15',
-            'version' => '5.4.15.0',
-            'reference' => '60e87188abbacd29ccde44d69c5392a33e888e98',
+            'pretty_version' => 'v5.4.21',
+            'version' => '5.4.21.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/cache',
             'aliases' => array(),
+            'reference' => '32cab695bf99c63aff7d27ac67919944c00530ed',
             'dev_requirement' => false,
         ),
         'symfony/cache-contracts' => array(
             'pretty_version' => 'v2.5.2',
             'version' => '2.5.2.0',
-            'reference' => '64be4a7acb83b6f2bf6de9a02cee6dad41277ebc',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/cache-contracts',
             'aliases' => array(),
+            'reference' => '64be4a7acb83b6f2bf6de9a02cee6dad41277ebc',
             'dev_requirement' => false,
         ),
         'symfony/cache-implementation' => array(
@@ -331,28 +340,28 @@
         'symfony/deprecation-contracts' => array(
             'pretty_version' => 'v2.5.2',
             'version' => '2.5.2.0',
-            'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
             'aliases' => array(),
+            'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
             'dev_requirement' => false,
         ),
         'symfony/event-dispatcher' => array(
-            'pretty_version' => 'v5.4.9',
-            'version' => '5.4.9.0',
-            'reference' => '8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc',
+            'pretty_version' => 'v5.4.21',
+            'version' => '5.4.21.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/event-dispatcher',
             'aliases' => array(),
+            'reference' => 'f0ae1383a8285dfc6752b8d8602790953118ff5a',
             'dev_requirement' => false,
         ),
         'symfony/event-dispatcher-contracts' => array(
             'pretty_version' => 'v2.5.2',
             'version' => '2.5.2.0',
-            'reference' => 'f98b54df6ad059855739db6fcbc2d36995283fe1',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts',
             'aliases' => array(),
+            'reference' => 'f98b54df6ad059855739db6fcbc2d36995283fe1',
             'dev_requirement' => false,
         ),
         'symfony/event-dispatcher-implementation' => array(
@@ -362,131 +371,129 @@
             ),
         ),
         'symfony/finder' => array(
-            'pretty_version' => 'v5.4.11',
-            'version' => '5.4.11.0',
-            'reference' => '7872a66f57caffa2916a584db1aa7f12adc76f8c',
+            'pretty_version' => 'v5.4.21',
+            'version' => '5.4.21.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/finder',
             'aliases' => array(),
+            'reference' => '078e9a5e1871fcfe6a5ce421b539344c21afef19',
             'dev_requirement' => false,
         ),
         'symfony/http-foundation' => array(
-            'pretty_version' => 'v5.4.16',
-            'version' => '5.4.16.0',
-            'reference' => '5032c5849aef24741e1970cb03511b0dd131d838',
+            'pretty_version' => 'v5.4.21',
+            'version' => '5.4.21.0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/http-foundation',
             'aliases' => array(),
+            'reference' => '3bb6ee5582366c4176d5ce596b380117c8200bbf',
             'dev_requirement' => false,
         ),
         'symfony/polyfill-mbstring' => array(
             'pretty_version' => 'v1.27.0',
             'version' => '1.27.0.0',
-            'reference' => '8ad114f6b39e2c98a8b0e3bd907732c207c2b534',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
             'aliases' => array(),
+            'reference' => '8ad114f6b39e2c98a8b0e3bd907732c207c2b534',
             'dev_requirement' => false,
         ),
         'symfony/polyfill-php73' => array(
             'pretty_version' => 'v1.27.0',
             'version' => '1.27.0.0',
-            'reference' => '9e8ecb5f92152187c4799efd3c96b78ccab18ff9',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/polyfill-php73',
             'aliases' => array(),
+            'reference' => '9e8ecb5f92152187c4799efd3c96b78ccab18ff9',
             'dev_requirement' => false,
         ),
         'symfony/polyfill-php80' => array(
             'pretty_version' => 'v1.27.0',
             'version' => '1.27.0.0',
-            'reference' => '7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/polyfill-php80',
             'aliases' => array(),
+            'reference' => '7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936',
             'dev_requirement' => false,
         ),
         'symfony/psr-http-message-bridge' => array(
             'pretty_version' => 'v2.1.4',
             'version' => '2.1.4.0',
-            'reference' => 'a125b93ef378c492e274f217874906fb9babdebb',
             'type' => 'symfony-bridge',
             'install_path' => __DIR__ . '/../symfony/psr-http-message-bridge',
             'aliases' => array(),
+            'reference' => 'a125b93ef378c492e274f217874906fb9babdebb',
             'dev_requirement' => false,
         ),
         'symfony/service-contracts' => array(
             'pretty_version' => 'v1.1.2',
             'version' => '1.1.2.0',
-            'reference' => '191afdcb5804db960d26d8566b7e9a2843cab3a0',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/service-contracts',
             'aliases' => array(),
+            'reference' => '191afdcb5804db960d26d8566b7e9a2843cab3a0',
             'dev_requirement' => false,
         ),
         'symfony/var-exporter' => array(
             'pretty_version' => 'v4.4.43',
             'version' => '4.4.43.0',
-            'reference' => '4a7a3a3d55c471d396e6d28011368b7b83cb518b',
             'type' => 'library',
             'install_path' => __DIR__ . '/../symfony/var-exporter',
             'aliases' => array(),
+            'reference' => '4a7a3a3d55c471d396e6d28011368b7b83cb518b',
             'dev_requirement' => false,
         ),
         'topthink/framework' => array(
             'pretty_version' => 'dev-master',
             'version' => 'dev-master',
-            'reference' => 'a5f1cedf07bb3489f7e3b5254496afbf600d4e65',
             'type' => 'think-framework',
             'install_path' => __DIR__ . '/../../thinkphp',
-            'aliases' => array(
-                0 => '9999999-dev',
-            ),
+            'aliases' => array(),
+            'reference' => '643c58ed1bd22a2823ce5e95b3b68a5075f9087c',
             'dev_requirement' => false,
         ),
         'topthink/think-captcha' => array(
             'pretty_version' => 'v1.0.7',
             'version' => '1.0.7.0',
-            'reference' => '0c55455df26a1626a60d0dc35d2d89002b741d44',
             'type' => 'library',
             'install_path' => __DIR__ . '/../topthink/think-captcha',
             'aliases' => array(),
+            'reference' => '0c55455df26a1626a60d0dc35d2d89002b741d44',
             'dev_requirement' => false,
         ),
         'topthink/think-helper' => array(
             'pretty_version' => 'v1.0.7',
             'version' => '1.0.7.0',
-            'reference' => '5f92178606c8ce131d36b37a57c58eb71e55f019',
             'type' => 'library',
             'install_path' => __DIR__ . '/../topthink/think-helper',
             'aliases' => array(),
+            'reference' => '5f92178606c8ce131d36b37a57c58eb71e55f019',
             'dev_requirement' => false,
         ),
         'topthink/think-installer' => array(
             'pretty_version' => 'v1.0.14',
             'version' => '1.0.14.0',
-            'reference' => 'eae1740ac264a55c06134b6685dfb9f837d004d1',
             'type' => 'composer-plugin',
             'install_path' => __DIR__ . '/../topthink/think-installer',
             'aliases' => array(),
+            'reference' => 'eae1740ac264a55c06134b6685dfb9f837d004d1',
             'dev_requirement' => false,
         ),
         'topthink/think-queue' => array(
             'pretty_version' => 'v1.1.6',
             'version' => '1.1.6.0',
-            'reference' => '250650eb0e8ea5af4cfdc7ae46f3f4e0a24ac245',
             'type' => 'think-extend',
             'install_path' => __DIR__ . '/../topthink/think-queue',
             'aliases' => array(),
+            'reference' => '250650eb0e8ea5af4cfdc7ae46f3f4e0a24ac245',
             'dev_requirement' => false,
         ),
         'txthinking/mailer' => array(
             'pretty_version' => 'v2.0.1',
             'version' => '2.0.1.0',
-            'reference' => '09013cf9dad3aac195f66ae5309e8c3343c018e9',
             'type' => 'library',
             'install_path' => __DIR__ . '/../txthinking/mailer',
             'aliases' => array(),
+            'reference' => '09013cf9dad3aac195f66ae5309e8c3343c018e9',
             'dev_requirement' => false,
         ),
     ),

+ 2 - 2
vendor/composer/platform_check.php

@@ -4,8 +4,8 @@
 
 $issues = array();
 
-if (!(PHP_VERSION_ID >= 70400)) {
-    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
+if (!(PHP_VERSION_ID >= 70205)) {
+    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.5". You are running ' . PHP_VERSION . '.';
 }
 
 if ($issues) {

+ 105 - 0
vendor/firebase/php-jwt/CHANGELOG.md

@@ -0,0 +1,105 @@
+# Changelog
+
+## [6.4.0](https://github.com/firebase/php-jwt/compare/v6.3.2...v6.4.0) (2023-02-08)
+
+
+### Features
+
+* add support for W3C ES256K ([#462](https://github.com/firebase/php-jwt/issues/462)) ([213924f](https://github.com/firebase/php-jwt/commit/213924f51936291fbbca99158b11bd4ae56c2c95))
+* improve caching by only decoding jwks when necessary ([#486](https://github.com/firebase/php-jwt/issues/486)) ([78d3ed1](https://github.com/firebase/php-jwt/commit/78d3ed1073553f7d0bbffa6c2010009a0d483d5c))
+
+## [6.3.2](https://github.com/firebase/php-jwt/compare/v6.3.1...v6.3.2) (2022-11-01)
+
+
+### Bug Fixes
+
+* check kid before using as array index ([bad1b04](https://github.com/firebase/php-jwt/commit/bad1b040d0c736bbf86814c6b5ae614f517cf7bd))
+
+## [6.3.1](https://github.com/firebase/php-jwt/compare/v6.3.0...v6.3.1) (2022-11-01)
+
+
+### Bug Fixes
+
+* casing of GET for PSR compat ([#451](https://github.com/firebase/php-jwt/issues/451)) ([60b52b7](https://github.com/firebase/php-jwt/commit/60b52b71978790eafcf3b95cfbd83db0439e8d22))
+* string interpolation format for php 8.2 ([#446](https://github.com/firebase/php-jwt/issues/446)) ([2e07d8a](https://github.com/firebase/php-jwt/commit/2e07d8a1524d12b69b110ad649f17461d068b8f2))
+
+## 6.3.0 / 2022-07-15
+
+ - Added ES256 support to JWK parsing ([#399](https://github.com/firebase/php-jwt/pull/399))
+ - Fixed potential caching error in `CachedKeySet` by caching jwks as strings ([#435](https://github.com/firebase/php-jwt/pull/435))
+
+## 6.2.0 / 2022-05-14
+
+ - Added `CachedKeySet` ([#397](https://github.com/firebase/php-jwt/pull/397))
+ - Added `$defaultAlg` parameter to `JWT::parseKey` and `JWT::parseKeySet` ([#426](https://github.com/firebase/php-jwt/pull/426)).
+
+## 6.1.0 / 2022-03-23
+
+ - Drop support for PHP 5.3, 5.4, 5.5, 5.6, and 7.0
+ - Add parameter typing and return types where possible
+
+## 6.0.0 / 2022-01-24
+
+ - **Backwards-Compatibility Breaking Changes**: See the [Release Notes](https://github.com/firebase/php-jwt/releases/tag/v6.0.0) for more information.
+ - New Key object to prevent key/algorithm type confusion (#365)
+ - Add JWK support (#273)
+ - Add ES256 support (#256)
+ - Add ES384 support (#324)
+ - Add Ed25519 support (#343)
+
+## 5.0.0 / 2017-06-26
+- Support RS384 and RS512.
+  See [#117](https://github.com/firebase/php-jwt/pull/117). Thanks [@joostfaassen](https://github.com/joostfaassen)!
+- Add an example for RS256 openssl.
+  See [#125](https://github.com/firebase/php-jwt/pull/125). Thanks [@akeeman](https://github.com/akeeman)!
+- Detect invalid Base64 encoding in signature.
+  See [#162](https://github.com/firebase/php-jwt/pull/162). Thanks [@psignoret](https://github.com/psignoret)!
+- Update `JWT::verify` to handle OpenSSL errors.
+  See [#159](https://github.com/firebase/php-jwt/pull/159). Thanks [@bshaffer](https://github.com/bshaffer)!
+- Add `array` type hinting to `decode` method
+  See [#101](https://github.com/firebase/php-jwt/pull/101). Thanks [@hywak](https://github.com/hywak)!
+- Add all JSON error types.
+  See [#110](https://github.com/firebase/php-jwt/pull/110). Thanks [@gbalduzzi](https://github.com/gbalduzzi)!
+- Bugfix 'kid' not in given key list.
+  See [#129](https://github.com/firebase/php-jwt/pull/129). Thanks [@stampycode](https://github.com/stampycode)!
+- Miscellaneous cleanup, documentation and test fixes.
+  See [#107](https://github.com/firebase/php-jwt/pull/107), [#115](https://github.com/firebase/php-jwt/pull/115),
+  [#160](https://github.com/firebase/php-jwt/pull/160), [#161](https://github.com/firebase/php-jwt/pull/161), and
+  [#165](https://github.com/firebase/php-jwt/pull/165). Thanks [@akeeman](https://github.com/akeeman),
+  [@chinedufn](https://github.com/chinedufn), and [@bshaffer](https://github.com/bshaffer)!
+
+## 4.0.0 / 2016-07-17
+- Add support for late static binding. See [#88](https://github.com/firebase/php-jwt/pull/88) for details. Thanks to [@chappy84](https://github.com/chappy84)!
+- Use static `$timestamp` instead of `time()` to improve unit testing. See [#93](https://github.com/firebase/php-jwt/pull/93) for details. Thanks to [@josephmcdermott](https://github.com/josephmcdermott)!
+- Fixes to exceptions classes. See [#81](https://github.com/firebase/php-jwt/pull/81) for details. Thanks to [@Maks3w](https://github.com/Maks3w)!
+- Fixes to PHPDoc. See [#76](https://github.com/firebase/php-jwt/pull/76) for details. Thanks to [@akeeman](https://github.com/akeeman)!
+
+## 3.0.0 / 2015-07-22
+- Minimum PHP version updated from `5.2.0` to `5.3.0`.
+- Add `\Firebase\JWT` namespace. See
+[#59](https://github.com/firebase/php-jwt/pull/59) for details. Thanks to
+[@Dashron](https://github.com/Dashron)!
+- Require a non-empty key to decode and verify a JWT. See
+[#60](https://github.com/firebase/php-jwt/pull/60) for details. Thanks to
+[@sjones608](https://github.com/sjones608)!
+- Cleaner documentation blocks in the code. See
+[#62](https://github.com/firebase/php-jwt/pull/62) for details. Thanks to
+[@johanderuijter](https://github.com/johanderuijter)!
+
+## 2.2.0 / 2015-06-22
+- Add support for adding custom, optional JWT headers to `JWT::encode()`. See
+[#53](https://github.com/firebase/php-jwt/pull/53/files) for details. Thanks to
+[@mcocaro](https://github.com/mcocaro)!
+
+## 2.1.0 / 2015-05-20
+- Add support for adding a leeway to `JWT:decode()` that accounts for clock skew
+between signing and verifying entities. Thanks to [@lcabral](https://github.com/lcabral)!
+- Add support for passing an object implementing the `ArrayAccess` interface for
+`$keys` argument in `JWT::decode()`. Thanks to [@aztech-dev](https://github.com/aztech-dev)!
+
+## 2.0.0 / 2015-04-01
+- **Note**: It is strongly recommended that you update to > v2.0.0 to address
+  known security vulnerabilities in prior versions when both symmetric and
+  asymmetric keys are used together.
+- Update signature for `JWT::decode(...)` to require an array of supported
+  algorithms to use when verifying token signatures.

+ 30 - 0
vendor/firebase/php-jwt/LICENSE

@@ -0,0 +1,30 @@
+Copyright (c) 2011, Neuman Vong
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of the copyright holder nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 332 - 0
vendor/firebase/php-jwt/README.md

@@ -0,0 +1,332 @@
+![Build Status](https://github.com/firebase/php-jwt/actions/workflows/tests.yml/badge.svg)
+[![Latest Stable Version](https://poser.pugx.org/firebase/php-jwt/v/stable)](https://packagist.org/packages/firebase/php-jwt)
+[![Total Downloads](https://poser.pugx.org/firebase/php-jwt/downloads)](https://packagist.org/packages/firebase/php-jwt)
+[![License](https://poser.pugx.org/firebase/php-jwt/license)](https://packagist.org/packages/firebase/php-jwt)
+
+PHP-JWT
+=======
+A simple library to encode and decode JSON Web Tokens (JWT) in PHP, conforming to [RFC 7519](https://tools.ietf.org/html/rfc7519).
+
+Installation
+------------
+
+Use composer to manage your dependencies and download PHP-JWT:
+
+```bash
+composer require firebase/php-jwt
+```
+
+Optionally, install the `paragonie/sodium_compat` package from composer if your
+php is < 7.2 or does not have libsodium installed:
+
+```bash
+composer require paragonie/sodium_compat
+```
+
+Example
+-------
+```php
+use Firebase\JWT\JWT;
+use Firebase\JWT\Key;
+
+$key = 'example_key';
+$payload = [
+    'iss' => 'http://example.org',
+    'aud' => 'http://example.com',
+    'iat' => 1356999524,
+    'nbf' => 1357000000
+];
+
+/**
+ * IMPORTANT:
+ * You must specify supported algorithms for your application. See
+ * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
+ * for a list of spec-compliant algorithms.
+ */
+$jwt = JWT::encode($payload, $key, 'HS256');
+$decoded = JWT::decode($jwt, new Key($key, 'HS256'));
+
+print_r($decoded);
+
+/*
+ NOTE: This will now be an object instead of an associative array. To get
+ an associative array, you will need to cast it as such:
+*/
+
+$decoded_array = (array) $decoded;
+
+/**
+ * You can add a leeway to account for when there is a clock skew times between
+ * the signing and verifying servers. It is recommended that this leeway should
+ * not be bigger than a few minutes.
+ *
+ * Source: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#nbfDef
+ */
+JWT::$leeway = 60; // $leeway in seconds
+$decoded = JWT::decode($jwt, new Key($key, 'HS256'));
+```
+Example with RS256 (openssl)
+----------------------------
+```php
+use Firebase\JWT\JWT;
+use Firebase\JWT\Key;
+
+$privateKey = <<<EOD
+-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQC8kGa1pSjbSYZVebtTRBLxBz5H4i2p/llLCrEeQhta5kaQu/Rn
+vuER4W8oDH3+3iuIYW4VQAzyqFpwuzjkDI+17t5t0tyazyZ8JXw+KgXTxldMPEL9
+5+qVhgXvwtihXC1c5oGbRlEDvDF6Sa53rcFVsYJ4ehde/zUxo6UvS7UrBQIDAQAB
+AoGAb/MXV46XxCFRxNuB8LyAtmLDgi/xRnTAlMHjSACddwkyKem8//8eZtw9fzxz
+bWZ/1/doQOuHBGYZU8aDzzj59FZ78dyzNFoF91hbvZKkg+6wGyd/LrGVEB+Xre0J
+Nil0GReM2AHDNZUYRv+HYJPIOrB0CRczLQsgFJ8K6aAD6F0CQQDzbpjYdx10qgK1
+cP59UHiHjPZYC0loEsk7s+hUmT3QHerAQJMZWC11Qrn2N+ybwwNblDKv+s5qgMQ5
+5tNoQ9IfAkEAxkyffU6ythpg/H0Ixe1I2rd0GbF05biIzO/i77Det3n4YsJVlDck
+ZkcvY3SK2iRIL4c9yY6hlIhs+K9wXTtGWwJBAO9Dskl48mO7woPR9uD22jDpNSwe
+k90OMepTjzSvlhjbfuPN1IdhqvSJTDychRwn1kIJ7LQZgQ8fVz9OCFZ/6qMCQGOb
+qaGwHmUK6xzpUbbacnYrIM6nLSkXgOAwv7XXCojvY614ILTK3iXiLBOxPu5Eu13k
+eUz9sHyD6vkgZzjtxXECQAkp4Xerf5TGfQXGXhxIX52yH+N2LtujCdkQZjXAsGdm
+B2zNzvrlgRmgBrklMTrMYgm1NPcW+bRLGcwgW2PTvNM=
+-----END RSA PRIVATE KEY-----
+EOD;
+
+$publicKey = <<<EOD
+-----BEGIN PUBLIC KEY-----
+MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8kGa1pSjbSYZVebtTRBLxBz5H
+4i2p/llLCrEeQhta5kaQu/RnvuER4W8oDH3+3iuIYW4VQAzyqFpwuzjkDI+17t5t
+0tyazyZ8JXw+KgXTxldMPEL95+qVhgXvwtihXC1c5oGbRlEDvDF6Sa53rcFVsYJ4
+ehde/zUxo6UvS7UrBQIDAQAB
+-----END PUBLIC KEY-----
+EOD;
+
+$payload = [
+    'iss' => 'example.org',
+    'aud' => 'example.com',
+    'iat' => 1356999524,
+    'nbf' => 1357000000
+];
+
+$jwt = JWT::encode($payload, $privateKey, 'RS256');
+echo "Encode:\n" . print_r($jwt, true) . "\n";
+
+$decoded = JWT::decode($jwt, new Key($publicKey, 'RS256'));
+
+/*
+ NOTE: This will now be an object instead of an associative array. To get
+ an associative array, you will need to cast it as such:
+*/
+
+$decoded_array = (array) $decoded;
+echo "Decode:\n" . print_r($decoded_array, true) . "\n";
+```
+
+Example with a passphrase
+-------------------------
+
+```php
+use Firebase\JWT\JWT;
+use Firebase\JWT\Key;
+
+// Your passphrase
+$passphrase = '[YOUR_PASSPHRASE]';
+
+// Your private key file with passphrase
+// Can be generated with "ssh-keygen -t rsa -m pem"
+$privateKeyFile = '/path/to/key-with-passphrase.pem';
+
+// Create a private key of type "resource"
+$privateKey = openssl_pkey_get_private(
+    file_get_contents($privateKeyFile),
+    $passphrase
+);
+
+$payload = [
+    'iss' => 'example.org',
+    'aud' => 'example.com',
+    'iat' => 1356999524,
+    'nbf' => 1357000000
+];
+
+$jwt = JWT::encode($payload, $privateKey, 'RS256');
+echo "Encode:\n" . print_r($jwt, true) . "\n";
+
+// Get public key from the private key, or pull from from a file.
+$publicKey = openssl_pkey_get_details($privateKey)['key'];
+
+$decoded = JWT::decode($jwt, new Key($publicKey, 'RS256'));
+echo "Decode:\n" . print_r((array) $decoded, true) . "\n";
+```
+
+Example with EdDSA (libsodium and Ed25519 signature)
+----------------------------
+```php
+use Firebase\JWT\JWT;
+use Firebase\JWT\Key;
+
+// Public and private keys are expected to be Base64 encoded. The last
+// non-empty line is used so that keys can be generated with
+// sodium_crypto_sign_keypair(). The secret keys generated by other tools may
+// need to be adjusted to match the input expected by libsodium.
+
+$keyPair = sodium_crypto_sign_keypair();
+
+$privateKey = base64_encode(sodium_crypto_sign_secretkey($keyPair));
+
+$publicKey = base64_encode(sodium_crypto_sign_publickey($keyPair));
+
+$payload = [
+    'iss' => 'example.org',
+    'aud' => 'example.com',
+    'iat' => 1356999524,
+    'nbf' => 1357000000
+];
+
+$jwt = JWT::encode($payload, $privateKey, 'EdDSA');
+echo "Encode:\n" . print_r($jwt, true) . "\n";
+
+$decoded = JWT::decode($jwt, new Key($publicKey, 'EdDSA'));
+echo "Decode:\n" . print_r((array) $decoded, true) . "\n";
+````
+
+Using JWKs
+----------
+
+```php
+use Firebase\JWT\JWK;
+use Firebase\JWT\JWT;
+
+// Set of keys. The "keys" key is required. For example, the JSON response to
+// this endpoint: https://www.gstatic.com/iap/verify/public_key-jwk
+$jwks = ['keys' => []];
+
+// JWK::parseKeySet($jwks) returns an associative array of **kid** to Firebase\JWT\Key
+// objects. Pass this as the second parameter to JWT::decode.
+JWT::decode($payload, JWK::parseKeySet($jwks));
+```
+
+Using Cached Key Sets
+---------------------
+
+The `CachedKeySet` class can be used to fetch and cache JWKS (JSON Web Key Sets) from a public URI.
+This has the following advantages:
+
+1. The results are cached for performance.
+2. If an unrecognized key is requested, the cache is refreshed, to accomodate for key rotation.
+3. If rate limiting is enabled, the JWKS URI will not make more than 10 requests a second.
+
+```php
+use Firebase\JWT\CachedKeySet;
+use Firebase\JWT\JWT;
+
+// The URI for the JWKS you wish to cache the results from
+$jwksUri = 'https://www.gstatic.com/iap/verify/public_key-jwk';
+
+// Create an HTTP client (can be any PSR-7 compatible HTTP client)
+$httpClient = new GuzzleHttp\Client();
+
+// Create an HTTP request factory (can be any PSR-17 compatible HTTP request factory)
+$httpFactory = new GuzzleHttp\Psr\HttpFactory();
+
+// Create a cache item pool (can be any PSR-6 compatible cache item pool)
+$cacheItemPool = Phpfastcache\CacheManager::getInstance('files');
+
+$keySet = new CachedKeySet(
+    $jwksUri,
+    $httpClient,
+    $httpFactory,
+    $cacheItemPool,
+    null, // $expiresAfter int seconds to set the JWKS to expire
+    true  // $rateLimit    true to enable rate limit of 10 RPS on lookup of invalid keys
+);
+
+$jwt = 'eyJhbGci...'; // Some JWT signed by a key from the $jwkUri above
+$decoded = JWT::decode($jwt, $keySet);
+```
+
+Miscellaneous
+-------------
+
+#### Exception Handling
+
+When a call to `JWT::decode` is invalid, it will throw one of the following exceptions:
+
+```php
+use Firebase\JWT\JWT;
+use Firebase\JWT\SignatureInvalidException;
+use Firebase\JWT\BeforeValidException;
+use Firebase\JWT\ExpiredException;
+use DomainException;
+use InvalidArgumentException;
+use UnexpectedValueException;
+
+try {
+    $decoded = JWT::decode($payload, $keys);
+} catch (InvalidArgumentException $e) {
+    // provided key/key-array is empty or malformed.
+} catch (DomainException $e) {
+    // provided algorithm is unsupported OR
+    // provided key is invalid OR
+    // unknown error thrown in openSSL or libsodium OR
+    // libsodium is required but not available.
+} catch (SignatureInvalidException $e) {
+    // provided JWT signature verification failed.
+} catch (BeforeValidException $e) {
+    // provided JWT is trying to be used before "nbf" claim OR
+    // provided JWT is trying to be used before "iat" claim.
+} catch (ExpiredException $e) {
+    // provided JWT is trying to be used after "exp" claim.
+} catch (UnexpectedValueException $e) {
+    // provided JWT is malformed OR
+    // provided JWT is missing an algorithm / using an unsupported algorithm OR
+    // provided JWT algorithm does not match provided key OR
+    // provided key ID in key/key-array is empty or invalid.
+}
+```
+
+All exceptions in the `Firebase\JWT` namespace extend `UnexpectedValueException`, and can be simplified
+like this:
+
+```php
+try {
+    $decoded = JWT::decode($payload, $keys);
+} catch (LogicException $e) {
+    // errors having to do with environmental setup or malformed JWT Keys
+} catch (UnexpectedValueException $e) {
+    // errors having to do with JWT signature and claims
+}
+```
+
+#### Casting to array
+
+The return value of `JWT::decode` is the generic PHP object `stdClass`. If you'd like to handle with arrays
+instead, you can do the following:
+
+```php
+// return type is stdClass
+$decoded = JWT::decode($payload, $keys);
+
+// cast to array
+$decoded = json_decode(json_encode($decoded), true);
+```
+
+Tests
+-----
+Run the tests using phpunit:
+
+```bash
+$ pear install PHPUnit
+$ phpunit --configuration phpunit.xml.dist
+PHPUnit 3.7.10 by Sebastian Bergmann.
+.....
+Time: 0 seconds, Memory: 2.50Mb
+OK (5 tests, 5 assertions)
+```
+
+New Lines in private keys
+-----
+
+If your private key contains `\n` characters, be sure to wrap it in double quotes `""`
+and not single quotes `''` in order to properly interpret the escaped characters.
+
+License
+-------
+[3-Clause BSD](http://opensource.org/licenses/BSD-3-Clause).

+ 42 - 0
vendor/firebase/php-jwt/composer.json

@@ -0,0 +1,42 @@
+{
+    "name": "firebase/php-jwt",
+    "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
+    "homepage": "https://github.com/firebase/php-jwt",
+    "keywords": [
+        "php",
+        "jwt"
+    ],
+    "authors": [
+        {
+            "name": "Neuman Vong",
+            "email": "neuman+pear@twilio.com",
+            "role": "Developer"
+        },
+        {
+            "name": "Anant Narayanan",
+            "email": "anant@php.net",
+            "role": "Developer"
+        }
+    ],
+    "license": "BSD-3-Clause",
+    "require": {
+        "php": "^7.1||^8.0"
+    },
+    "suggest": {
+        "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present",
+        "ext-sodium": "Support EdDSA (Ed25519) signatures"
+    },
+    "autoload": {
+        "psr-4": {
+            "Firebase\\JWT\\": "src"
+        }
+    },
+    "require-dev": {
+        "guzzlehttp/guzzle": "^6.5||^7.4",
+        "phpspec/prophecy-phpunit": "^1.1",
+        "phpunit/phpunit": "^7.5||^9.5",
+        "psr/cache": "^1.0||^2.0",
+        "psr/http-client": "^1.0",
+        "psr/http-factory": "^1.0"
+    }
+}

+ 7 - 0
vendor/firebase/php-jwt/src/BeforeValidException.php

@@ -0,0 +1,7 @@
+<?php
+
+namespace Firebase\JWT;
+
+class BeforeValidException extends \UnexpectedValueException
+{
+}

+ 0 - 0
vendor/firebase/php-jwt/src/CachedKeySet.php


Някои файлове не бяха показани, защото твърде много файлове са промени