mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
32 lines
806 B
PHP
32 lines
806 B
PHP
<?php
|
|
|
|
namespace Tests;
|
|
|
|
use Schema;
|
|
use Carbon\Carbon;
|
|
use App\Models\User;
|
|
use App\Models\Player;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
class UserTest extends TestCase
|
|
{
|
|
use DatabaseTransactions;
|
|
|
|
public function testGetPlayerNameAttribute()
|
|
{
|
|
$user = factory(User::class)->create();
|
|
$player = factory(Player::class)->create(['uid' => $user->uid]);
|
|
$this->assertEquals($player->name, $user->player_name);
|
|
}
|
|
|
|
public function testSetPlayerNameAttribute()
|
|
{
|
|
$user = factory(User::class)->create();
|
|
$player = factory(Player::class)->create(['uid' => $user->uid]);
|
|
$user->player_name = 'a';
|
|
$player->refresh();
|
|
$this->assertEquals('a', $player->name);
|
|
}
|
|
}
|