This commit is contained in:
Pig Fang 2019-08-08 13:55:41 +08:00
parent 55346ac4c0
commit 06b4ec0dbe

View File

@ -16,6 +16,7 @@ class UserTest extends TestCase
public function testConvertQuery()
{
if (config('database.default') == 'mysql') {
$this->assertStringContainsString(
'where `bs_email`',
ExtendedUser::where('email', '')->toSql()
@ -36,6 +37,28 @@ class UserTest extends TestCase
'having `bs_permission`',
ExtendedUser::having('permission')->toSql()
);
} else {
$this->assertStringContainsString(
'where "bs_email"',
ExtendedUser::where('email', '')->toSql()
);
$this->assertStringContainsString(
'select "bs_email" from',
ExtendedUser::select(['email'])->toSql()
);
$this->assertStringContainsString(
'order by "bs_score"',
ExtendedUser::orderBy('score')->toSql()
);
$this->assertStringContainsString(
'group by "bs_permission"',
ExtendedUser::groupBy('permission')->toSql()
);
$this->assertStringContainsString(
'having "bs_permission"',
ExtendedUser::having('permission')->toSql()
);
}
}
public function testGetUidAttribute()