remove hack for test

This commit is contained in:
Pig Fang 2018-07-14 08:41:25 +08:00
parent b6cda88ae4
commit b520a464cb
2 changed files with 4 additions and 8 deletions

View File

@ -69,11 +69,6 @@ class UserController extends Controller
*/
public function sign()
{
// Hacking for testing
if (config('app.env') == 'testing') {
$this->user = User::find($this->user->uid);
}
if ($this->user->canSign()) {
$acquiredScore = $this->user->sign();

View File

@ -88,9 +88,10 @@ class UserControllerTest extends TestCase
)
]);
$user->last_sign_at = \Carbon\Carbon::today()->toDateTimeString();
$user->save();
$this->postJson('/user/sign')
$user = factory(User::class)->create([
'last_sign_at' => \Carbon\Carbon::today()->toDateTimeString()
]);
$this->actAs($user)->postJson('/user/sign')
->assertJson([
'errno' => 0
]);