查询数据.find
Testing Is Documentation
Uses
php
<?php
use Leevel\Kernel\Utils\Api;
use Tests\Database\DatabaseTestCase as TestCase;
find 查询基础用法
php
public function testBaseUse(): void
{
$connect = $this->createDatabaseConnectMock();
$sql = <<<'eot'
[
"SELECT `test`.* FROM `test`",
[],
false
]
eot;
self::assertSame(
$sql,
$this->varJsonSql(
$connect->table('test')
->find(),
$connect
)
);
}
find 查询指定数量
php
public function testFindLimit(): void
{
$connect = $this->createDatabaseConnectMock();
$sql = <<<'eot'
[
"SELECT `test`.* FROM `test` LIMIT 0,5",
[],
false
]
eot;
self::assertSame(
$sql,
$this->varJsonSql(
$connect->table('test')
->find(5),
$connect,
1
)
);
}