Skip to content

清空数据.truncate

Uses

php
<?php

use Leevel\Kernel\Utils\Api;
use Tests\Database\DatabaseTestCase as TestCase;

truncate 基本用法

清理没有返回值。

php
public function testBaseUse(): void
{
    $connect = $this->createDatabaseConnectMock();

    $sql = <<<'eot'
        [
            "TRUNCATE TABLE `test`",
            [],
            false
        ]
        eot;

    self::assertSame(
        $sql,
        $this->varJsonSql(
            $connect->table('test')
                ->truncate(),
            $connect
        )
    );
}