Fix tests for SQLite database
This commit is contained in:
parent
35c5b469a0
commit
5e00131db4
|
|
@ -33,6 +33,19 @@ class Player extends Model
|
|||
public $timestamps = false;
|
||||
protected $fillable = ['uid', 'player_name', 'preference', 'last_modified'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'pid' => 'integer',
|
||||
'uid' => 'integer',
|
||||
'tid_steve' => 'integer',
|
||||
'tid_alex' => 'integer',
|
||||
'tid_cape' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Check if the player is banned.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -9,6 +9,19 @@ class Texture extends Model
|
|||
public $primaryKey = 'tid';
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'tid' => 'integer',
|
||||
'likes' => 'integer',
|
||||
'size' => 'integer',
|
||||
'uploader' => 'integer',
|
||||
'public' => 'integer',
|
||||
];
|
||||
|
||||
public function setPrivacy($public)
|
||||
{
|
||||
$this->public = $public ? "1" : "0";
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ class User extends Model
|
|||
* User Token.
|
||||
* @var string
|
||||
*/
|
||||
private $token;
|
||||
protected $token;
|
||||
|
||||
/**
|
||||
* Instance of Closet.
|
||||
* @var App\Models\Closet
|
||||
* @var \App\Models\Closet
|
||||
*/
|
||||
private $closet;
|
||||
protected $closet;
|
||||
|
||||
/**
|
||||
* Properties for Eloquent Model.
|
||||
|
|
@ -37,6 +37,18 @@ class User extends Model
|
|||
public $timestamps = false;
|
||||
protected $fillable = ['email', 'nickname', 'permission'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'uid' => 'integer',
|
||||
'score' => 'integer',
|
||||
'avatar' => 'integer',
|
||||
'permission' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Storage size used by user in KiB.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -37,9 +37,16 @@ class SetupControllerTest extends TestCase
|
|||
|
||||
public function testWelcome()
|
||||
{
|
||||
$this->visit('/setup')
|
||||
->see(config('database.connections.mysql.username'))
|
||||
->see(config('database.connections.mysql.host'));
|
||||
$type = get_db_type();
|
||||
|
||||
if ($type === 'SQLite') {
|
||||
$server = get_db_config()['database'];
|
||||
} else {
|
||||
$config = get_db_config();
|
||||
$server = "{$config['username']}@{$config['host']}";
|
||||
}
|
||||
|
||||
$this->visit('/setup')->see($type)->see($server);
|
||||
}
|
||||
|
||||
public function testInfo()
|
||||
|
|
|
|||
|
|
@ -793,7 +793,7 @@ class SkinlibControllerTest extends TestCase
|
|||
->seeJson([
|
||||
'errno' => 0,
|
||||
'msg' => trans('skinlib.privacy.success', ['privacy' => trans('general.private')]),
|
||||
'public' => '0'
|
||||
'public' => 0
|
||||
]);
|
||||
$this->assertEquals(0, Texture::find($texture->tid)->public);
|
||||
|
||||
|
|
@ -818,7 +818,7 @@ class SkinlibControllerTest extends TestCase
|
|||
->seeJson([
|
||||
'errno' => 0,
|
||||
'msg' => trans('skinlib.privacy.success', ['privacy' => trans('general.private')]),
|
||||
'public' => '0'
|
||||
'public' => 0
|
||||
]);
|
||||
$this->assertEquals(0, User::find($uploader->uid)->score);
|
||||
|
||||
|
|
@ -833,7 +833,7 @@ class SkinlibControllerTest extends TestCase
|
|||
->seeJson([
|
||||
'errno' => 0,
|
||||
'msg' => trans('skinlib.privacy.success', ['privacy' => trans('general.private')]),
|
||||
'public' => '0'
|
||||
'public' => 0
|
||||
]);
|
||||
$this->assertEquals(0, Player::find($player->pid)->tid_steve);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user