-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractDbModelTest.php
More file actions
38 lines (35 loc) · 1.55 KB
/
AbstractDbModelTest.php
File metadata and controls
38 lines (35 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php declare(strict_types=1);
namespace Tests\DbModel;
use PHPUnit\Framework\TestCase;
/**
* 测试 php-db-model\DbModel\AbstractDbModel
*
* @covers \DbModel\AbstractDbModel
* @author fdipzone
*/
final class AbstractDbModelTest extends TestCase
{
public function testAbstractDbModel()
{
$config = new \Tests\DbModel\TestModel\Config;
$this->assertEquals('test_common', $config->dbName());
$this->assertEquals('config', $config->tableName());
$this->assertEquals('配置表', $config->tableComment());
$this->assertEquals('InnoDB', $config->engine());
$this->assertEquals('utf8mb4', $config->defaultCharset());
$this->assertEquals('utf8mb4_unicode_ci', $config->collate());
$this->assertEquals('id', $config->primaryKey());
$this->assertEquals('1', $config->autoIncrement());
$this->assertEquals('', $config->tableIndex());
$user = new \Tests\DbModel\TestModel\User;
$this->assertEquals('test_user', $user->dbName());
$this->assertEquals('user', $user->tableName());
$this->assertEquals('用户表', $user->tableComment());
$this->assertEquals('InnoDB', $user->engine());
$this->assertEquals('utf8mb4', $user->defaultCharset());
$this->assertEquals('utf8mb4_unicode_ci', $user->collate());
$this->assertEquals('id', $user->primaryKey());
$this->assertEquals('1001', $user->autoIncrement());
$this->assertEquals('UNIQUE INDEX `phone` (`phone` ASC),'.PHP_EOL.'INDEX `age` (`age` ASC)', $user->tableIndex());
}
}