public function testUserRegister() { $path = base_path('tests/storage/logs/user_register.log'); \Log::useFiles($path); $user = $this->service->registerUser([]); $this->assertFileExists($path); $content = file_get_contents($path); $this->assertNotFalse(strpos($content, '*****@*****.**')); $this->assertNotFalse(strpos($content, 'ユーザー登録が完了しました')); $this->assertNotFalse(strpos($content, 'testing')); $this->beforeApplicationDestroyed(function () use($path) { \File::delete($path); }); }
/** * @param UserRegisterRequest $request * @param UserService $user * @return \Illuminate\Http\RedirectResponse */ public function postRegister(UserRegisterRequest $request, UserService $user) { $input = $request->only(['name', 'email', 'password']); $result = $user->registerUser($input); $this->auth->login($result); return redirect()->route('admin.entry.index'); }
/** * @param UserRegisterRequest $request * @param UserService $user * * @return \Illuminate\Http\RedirectResponse */ public function postRegister(UserRegisterRequest $request, UserService $user) { $result = $user->registerUser($request->only(['name', 'email', 'password'])); $this->auth->login($result); return redirect()->route('admin.entry.index')->with('register_message', trans('message.register.success')); }