loginAsUser(); $this->visit(route('profile')); $this->seePageIs(route('profile')); $this->submitForm('set_father_button', [ 'set_father' => 'Nama Ayah', ]); $this->seeInDatabase('users', [ 'nickname' => 'Nama Ayah', ]); $this->assertEquals('Nama Ayah', $user->fresh()->father->nickname); } /** @test */ public function user_can_update_their_mother() { $user = $this->loginAsUser(); $this->visit(route('profile')); $this->seePageIs(route('profile')); $this->submitForm('set_mother_button', [ 'set_mother' => 'Nama Ibu', ]); $this->seeInDatabase('users', [ 'nickname' => 'Nama Ibu', ]); $this->assertEquals('Nama Ibu', $user->fresh()->mother->nickname); } /** @test */ public function user_can_add_childrens() { $user = $this->loginAsUser(['gender_id' => 1]); $this->visit(route('profile')); $this->seePageIs(route('profile')); $this->seeElement('input', ['name' => 'add_child_name']); $this->seeElement('input', ['name' => 'add_child_gender_id']); $this->submitForm('Tambah Anak', [ 'add_child_name' => 'Nama Anak 1', 'add_child_gender_id' => 1, ]); $this->seeInDatabase('users', [ 'nickname' => 'Nama Anak 1', 'gender_id' => 1, 'father_id' => $user->id, ]); } }