查询单条数据.findOne ¶
Testing Is Documentation
Uses
php
<?php
use Tests\Database\DatabaseTestCase as TestCase;
findOne 查询单条数据 ¶
php
public function testBaseUse(): void
{
$connect = $this->createDatabaseConnectMock();
$sql = <<<'eot'
[
"SELECT `test`.* FROM `test` LIMIT 1",
[],
false
]
eot;
static::assertSame(
$sql,
$this->varJsonSql(
$connect
->table('test')
->findOne(),
$connect
)
);
}
one.find 查询单条数据 ¶
php
public function testOneFind(): void
{
$connect = $this->createDatabaseConnectMock();
$sql = <<<'eot'
[
"SELECT `test`.* FROM `test` LIMIT 1",
[],
false
]
eot;
static::assertSame(
$sql,
$this->varJsonSql(
$connect
->table('test')
->one()
->find(),
$connect
)
);
}