vendor/topthink/framework/tests/DbTest.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace think\tests;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use think\Cache;
use think\Config;
use think\Db;
use think\Event;
use think\Log;
class DbTest extends TestCase
{
protected function tearDown(): void
{
m::close();
}
public function testMake()
{
$event = m::mock(Event::class);
$config = m::mock(Config::class);
$log = m::mock(Log::class);
$cache = m::mock(Cache::class);
$db = Db::__make($event, $config, $log, $cache);
$config->shouldReceive('get')->with('database.foo', null)->andReturn('foo');
$this->assertEquals('foo', $db->getConfig('foo'));
$config->shouldReceive('get')->with('database', [])->andReturn([]);
$this->assertEquals([], $db->getConfig());
$callback = function () {
};
$event->shouldReceive('listen')->with('db.some', $callback);
$db->event('some', $callback);
$event->shouldReceive('trigger')->with('db.some', null, false);
$db->trigger('some');
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
