wsteel/tp50unit

一个简单的thinkphp5.0单元测试

安装: 21

依赖关系: 0

建议者: 0

安全性: 0

星标: 1

关注者: 1

分支: 0

公开问题: 0

类型:phpunit

v0.1.5 2018-09-18 10:45 UTC

This package is auto-updated.

Last update: 2024-09-15 19:55:13 UTC


README

使用phpstorm 2018测试thinkphp5.0应用程序的逻辑

用法

composer require wsteel/php50unit

需求

"php": ">=7.0.0",
"topthink/framework": "5.0.*"
"phpunit/phpunit": "6.*"

演示

文件名

tests/demo/demoTest.php

内容

namespace tests\demo;

use wsteel\tp50unit\TestCase;

class demoTest extends TestCase
{

    public function testTrue()
    {
        $this->assertTrue(true);
    }

    public function testFalse()
    {
        $this->assertFalse(false, 'false');
    }


    public function testModel()
    {
        $e = \app\serverapi\model\Users::get(1)->toArray();
        $this->assertNotEmpty($e);
    }

    public function testM()
    {
        $user = model('users', 'serverapi\model');
        $e = $user->where('id', 1)->find()->toArray();
        $this->assertNotEmpty($e);
    }

    public function testDB()
    {
        $user = \think\Db::name('server_user');
        $e = $user->where('id', 1)->find();
        $this->assertNotEmpty($e);
    }

    public function testConfig()
    {
        $config = config('serverapi');
        $this->assertNotEmpty($config);
    }
}